Faster compilation speed
Noel Yap
yap_noel@yahoo.com
Sat Aug 10 16:07:00 GMT 2002
--- Stan Shebs <shebs@apple.com> wrote:
> Noel Yap wrote:
>
> >Build speeds are most helped by minimizing the
> number
> >of files opened and closed during the build.
> >
> Is this assertion based on empirical measurement,
> and if so, for what
> source code and what system? For instance, the
> longest source file
> in GCC is about 15K lines, and at -O2, only a small
> percentage of
> time is spent messing with files. If I use
> -save-temps on cp/decl.c on
> one of my (Linux) machines, I get a total time of
> about 38 sec from
> source to asm. If I just compile decl.i, it's about
> 37 sec, so that's
> 1 sec for *all* preprocessing, including all file
> opening/closing.
This is a good question.
John Lakos in _Large-Scale C++ Software Development_
has performed a rudimentary case study. If the
conclusions are true, then your example indicates that
there wasn't much of a difference between the number
of files used when compiling decl.c and decl.i.
The study also indicates that having #include's within
header files is the largest contributor to the problem
(since nested #include's would increase the number of
file accesses combinatorially).
As another indication that the conclusion is true,
Lakos added guards around the #include lines
themselves and found compile times to dramatically
decrease. For example:
#if header_h
# include <header.h>
#endif
I can go on, but I doubt others on this list would
appreciate a reprint of the chapter. If you don't
have the book, I suggest at least finding a copy and
reading this chapter.
> Obviously, other programs will have different
> characteristics, and if
> you have one for which file opening/closing
> dominates compile time,
> that will be very interesting. But it's bad to try
> to optimize
> something before you have numerical evidence.
I agree.
Would you agree with Lakos's findings as evidence to
this fact?
Noel
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
More information about the Gcc
mailing list