On Sun, Nov 20, 2011 at 03:43, Jeff Evarts <rivent...@gmail.com> wrote: > I posted this question at irc://irc.oftc.net/#gcc and they suggested > that I pose it here instead. > > I do some "large-ish" builds (linux, gcc itself, etc) on a too-regular > basis, and I was wondering what could be done to speed things up. A > little printf-style checking hints to me that I might be spending the > majority of my time in CPP rather g++, gasm, ld, etc. Has anyone > (ever, regularly, or recently) built gcc (g++, gcpp) with profiling > turned on? Is it hard? Did you get good results? > > Specifically I'm wondering what percentage of a g++ compile is spent > in one of three places: > > 1) opening/reading header files > 2) opening/reading source files > 3) doing everything else > > Thanks in advance for any pointers, results, or thoughts.
We (Google) did such measurements on our code base. The answer is highly dependent on the nature of your code base. We found a significant amount of time spent parsing header files, so we are implementing a caching scheme for avoiding repeated parsing actions on the same header files (http://gcc.gnu.org/wiki/pph). You will find our findings and what we are doing about the problem. Our short answer: in our code base, the parser spends between 50%-80% of the total compilation time. There has been some other profiling efforts as part of the Google Summer of Code program, but I cannot find a link for you atm. Some thoughts on compile time are here: http://gcc.gnu.org/wiki/Speedup_areas Diego.