This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: query reg. gcc



On Dec 22, 2004, at 8:09 PM, Deepak Soi wrote:


Paul,
First of all, thanks for the fast reply. What I feel is ,I can't use precompiled headers in my project. As i have a number of modules in our whole project, and each module has different header requirements. However with in a module , the headers required by all .cpp files are almost same.So in case I set aside few headers to be pre-compiled for whole project, it won't work. Also, second thing is i don't know about the which header files will be reqd. by each module in advance , without scanning the whole project, so i can't choose which headers to precompile.
Whereas if we can cache the header-file which is once loaded in to memory, then later if its reqd, we won't load it again, during the compilation of next .cpp file, it can be of help- in saving the compilation time of the next .cpp file. What you suggest? Can it be an additional functionality? Do we have something to support it right now in gcc ?

You don't say what OS you're on, but in most cases, a new subprocess is
invoked for each file that's compiled, and it retains no in-memory data from
the previous file. So there's no way to do what you're asking. Precompiled
headers put the data to be retained on disk, and that's the best you can do.
(Incidentally, the multiple subprocesses are partly responsible for the slowdown
you're seeing, although it's probably a minor effect compared to the header
files. You might try -combine, which gets rid of the multiple subprocesses but
not the rereading of header files. Be prepared for it to run out of memory on
a big project, though.)


It is probably worth the effort to figure out subset(s) of your header files that can
profitably be made into precompiled headers. It sounds like one pch for
each of your modules would work well.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]