This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Precompiled headers
- From: Robert Vazan <robertvazan at privateweb dot sk>
- To: gcc at gcc dot gnu dot org
- Date: Sun, 2 Nov 2003 11:20:13 +0100 (CET)
- Subject: Precompiled headers
Hi,
I've got tired of lenghty compilations and decided to do something about
it. As expected, precompiled headers have been discussed several times,
some attempts were made and something gets into 3.4 release.
>From various comments, I judge that it just dumps compiler state into gch
file and reloads it for next source file. It is rumoured to give six times
faster compilations. Improvement from 12 to 2 minutes is not enough for me,
not to mention that simplified header structure means 2-3 times more
recompiling. I need it under one second.
My strategy is to track dependencies down to inidividual function
declarations and structures. Then diff changes in parsed headers and
rebuild only those files that really depend on modified statements. If
there is just one typedef added without name conflict, nothing is rebuilt.
One option is to work over plain sources, but here I get into complexities
of various languages and I cannot make it work anywhere but in C. Other
option is to use one of compiler's internal structures, that abstract away
most of C++ mess into easy to trap lookups. I am not Gcc developer, but I
have weird feeling that current sources aren't doing such nice database
lookups, that I could hang on. I am not going to rewrite half the compiler,
of course.
So what would you recommend to me? Is there any small part of compiler that
"sees" all dependencies as the code is compiled? I can make dependency
tracker for C easily as external program. Are there any libs that could
help me? I know about incremental linking and constant linking, but
dependencies are going to make biggest difference right now.