clang's build performance

Ian Wadham iandw.au at gmail.com
Mon Jul 7 03:39:52 PDT 2014


On 07/07/2014, at 6:16 PM, René J.V. Bertin wrote:
> On Monday July 07 2014 08:43:33 Akim Demaille wrote:
> I think I agree with your assessment, I've thought the same thing. My 'anecdata' on Linux do tend to show that clang remains the faster compiler.
> Interestingly, gcc has long been incomprehensibly slower on OS X/ppc than it was under Linux, on an otherwise faster system (G4 vs. P3m), with similar discrepancies observable in scripting languages like R and Python. I wonder if we're observing something related here, but that wouldn't explain why Apple's builds are so much faster. Pity they don't seem to provide the full source on opensource.darwin.org, only something called llvmCore .
> 
>> Is there a means to specify configure flags for a specific port?
>> Since I'm spending quite some time compiling, I'd like to try
>> compiling clang-3.5 itself with -O3.
> 
> IIRC I tried invoking `port` with CC, CXX, CFLAGS etc. set to my own values only to note that they were reset.
> For experimenting you could copy the port directory (port dir llvm-3.5) to your local 'repository', and edit the Porfile. Llvm's configure script has an option to specify your own optimisation flags. I'm not sure if -O3 vs. -O2 will make a lot of difference instead of in build time though. You could add -mdynamic-no-pic (and check if --enable-pic isn't there to counter its effect), and add the -march flag for your CPU plus `-fvectorize -fslp-vectorize-aggressive`

FWIW, and this is perhaps completely off-topic, I find that Clang performs
well enough almost all of the time.  However, sometimes it expands
seemingly without limit, both in wall clock time and memory space (as
reported by the Real Mem column of Apple's Activity Monitor).  This
happens every time I try to build (from KDE repositories) the KDE
module set:

    akonadi kdepimlibs kde-baseapps konsole kate

Kate compiles fairly fast and gets to "100%" (compiled?), then it stays at
"100%" for many minutes, while the Real Mem climbs slowly to about
3Gb (out of the 4Gb I have on my machine), while Clang's CPU time
stays fairly low (20-30%IIRC) and the disk seems to be thrashing too.

IMHO no piece of software should ever do this sort of thing.  I get around
it all by just leaving Kate out of the above… ;-)

Could episodes like this be affecting Clang performance measurements?

Cheers, Ian W.




More information about the macports-users mailing list