precompiled headers can cause big slowdowns
Robert Lipe
robertlipe@usa.net
Tue Apr 17 08:04:00 GMT 2001
Fergus Henderson wrote:
> Recently some people have been working on porting Mercury to Mac OS X.
> One of them reported that he had finally succeeded in installing it,
> but that `make install' took two days (!). Part of the problem seems to be
> with the precompiled headers stuff in Apple's version of gcc:
While I don't want to turn this into a Apple bug reporting list, let me
suggest that this may not be entirely generic PCH suckage.
There is a user-mode test program in the UDI code where I used plain old
C preprocessing to repeat some code in the completely obvious way:
#define REPEAT2(a,b,c) a,b,c, a,b,c
#define REPEAT4(a,b,c) REPEAT2(a,b,c), REPEAT2(a,b,c)
#define REPEAT5(a,b,c) REPEAT2(a,b,c), REPEAT2(a,b,c), a,b,c
#define REPEAT10(a,b,c) REPEAT5(a,b,c), REPEAT5(a,b,c)
#define REPEAT20(a,b,c) REPEAT10(a,b,c), REPEAT10(a,b,c)
... in obvious combinations upward to 10k
The macro was used to emit one line of data in a struct. The total
resulting struct was under 128Kbyte, so we aren't talking about huge
amounts of data or anything.
The code in question builds in under a minute on a 500-ish Mhz
IA systems with a variety of vendor compilers including GCC of
various birth dates.
It took 97 minutes with the Darwin compiler and cpp-precomp was the
consumer of clock cycles.
RJL
>
> ----- Forwarded message from Richard Hagen <r.hagen@mailbox.uq.edu.au> -----
>
> The problem with excessive compilation time under Mac OS X/Darwin seems
> to be coming from the use of cpp-precomp by gcc. I'm currently looking at
> a compilation of the tree234 module where cpp-precomp has just clocked over
> 246 minutes of CPU time (that's over 4 hours in the old money).
>
> I'll see if forcing traditional cpp behaviour helps at all.
>
> ----- End forwarded message -----
>
> So, a couple of points to note:
>
> - precompiled headers don't necessarily improve compilation speed;
> if you're not careful, in some cases they can make it much worse
>
> - the Mercury distribution (which is available from
> < http://www.cs.mu.oz.au/mercury/download.html >) may be a useful
> source of some "nasty" real-world test cases for precompiled header
> implementations.
>
> --
> Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
> | of excellence is a lethal habit"
> WWW: < http://www.cs.mu.oz.au/~fjh > | -- the last words of T. S. Garp.
More information about the Gcc
mailing list