Compilation time regression?


I recently upgraded from "Apple LLVM version 4.2 (clang-425.0.24)
(based on LLVM 3.2svn)"
to "Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)"
and noticed a large increase in compilation time for our code, which
relies heavily on Boost Proto.

The problem is confirmed using a small test (attached), yielding the
following compilation times:
Clang 3.2 OS X binaries from the site: 1.69 s
Clang 3.3 OS X binaries from the site: 7.93 s
The LLVM3.3 Apple version: 10.66 s

Is this a bug, or is there some setting that can be changed to speed
up the compilation of this kind of template code? The new version
seems to use only about half as much RAM as before, so maybe there's
some memory/speed trade-off?

Kind regards,


proto.cpp (889 Bytes)

Interesting you raised this Bart. I’ve also had a suspicion there may be a few compilation performance regressions but I’m afraid I’ve got nothing to back that up as of yet. If I get the time I’ll try and put my suspicions to the test.

However, I was wondering if anyone were running any form of performance regression tests for clang compilation times? I realise it might be time consuming to maintain but the data could be invaluable for preserving clang performance. Even if it were internal tracked it would just be nice to know someone had an eye on it given how important a metric it is to the average coder.


On my machine I got

$ time ./clang-3.3 -cc1 -ftemplate-depth 512 proto.ii -o test.o
real 0m2.932s
user 0m2.889s
sys 0m0.035s

[espindola@desktop llvm]$ time ./clang-3.4 -cc1 -ftemplate-depth 512
proto.ii -o test.o
real 0m0.918s
user 0m0.873s
sys 0m0.042s

Can you check if 3.4 fixes the problem for you? If not, please open a
bug with the preprocessed source code.


Thanks, I have added a bug at:

3.4 is faster for me too, but only by a factor of two, still much
slower than 3.2.



Is your version from git compiled with or without assertions enabled ?


This is with assertions disabled.