Precompiled Header support for GCC-3.4

Mike Stump mrs@apple.com
Thu Sep 9 20:32:00 GMT 2004


On Sep 9, 2004, at 5:06 AM, Prasad Kulkarni wrote:
>  I was just trying my hand at precompiled header support provided by
> gcc 3.4. In one my project I have got 4 modules.

I don't know what a module is.

> Then I generated one PCH each of translational unit. Still its build
> time higher than the one without PCH.
>
> Can anybody please enlighten me about the logic behind this?

Sure, PCH has a non-zero overhead, that makes it not worth while if you 
use a PCH file once (for one translation unit), and never again.  If 
you change the .c files and never modify .h files, then you might want 
to do this for rapid development, otherwise, no.

> If I have lots of header files for a module and want decrease the build
> time of module is PCH right thing to go? If yes, then how I can do it?

No, this isn't what PCH is and does.

> Also is there any special flags are there that I need to  add or omit
> while compilation that may effect my build time considerably? Are
> there any any special configuration options that I need to specify
> while building gcc itself to take complete advantage of PCH?

If you only have 4 translation units, you aren't the type of user PCH 
targets.  PCH targets people with 200 units, each 20 lines long, with 
200K worth of headers in each unit, and the same 200K worth of headers 
in each unit.



More information about the Gcc mailing list