On 29 Jul 2010, at 11:05, Adriaan van Os wrote:
Jonas Maebe wrote:
If you put everything in a single compilation unit, then the compiler can optimize more, but if the goal is speeding up compilation then it will probably be counterproductive (possibly unless you only care about compilation speed for -O0 and not at all when using -O1 or higher).
It depends where the compiler is spending its time, generating code or processing declarations, reading unit symbols, etcetera. For GPC on Mac OS X, the bottleneck is absolutely the latter.
I don't think the current GPC unit loading architecture is comparable to how a C++ backend would work. And as I said, it is very much depends on the size of the compilation unit: larger compilation units generally take more or less linearly more time to parse, but the optimization time generally rises much more steeply (especially with newer compilers that perform more inter-procedural analyses).
At least that's my experience with compiling Apple's ld64, whose code is virtually all contained in large .hpp files that in turn are included in the main .cpp file. It's only about 680KB of code (mild usage of templates, but no complex template programming), but it takes a disproportionately long time to compile.
Jonas