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]

Re: Precompiler headers



If I may add my 2 (Euro)Cent to this discussion:

I come from the C++ scientific computing corner, where we frequently have
to deal with compilation times of several hours, i.e. at least two orders
of magnitude larger than what one needs for the Linux kernel at present,
for example. The reason for these compilation times is certainly the size
of the projects as well, but mostly the complexity of the code. Often many
template classes are used, heavy use of STL, operator overloading, many
inline functions, etc. As opposed to most projects coded in C, there is
actually a lot of code in the headers, not only declarations, and the time
needed for I/O is not dominant over processing.

For this reason, I would think that some of the approaches discussed here
are not fully sufficient if one would like to reduce compile times
significantly. In particular, for the projects outlined above,
- Only running the preprocessor and maybe tokenizing is not enough
- One would need to do all the parsing, maybe even up to tree generation
  and then dump the present state of the compiler after reading the
  includes to disk. This might be done for each source file, as
  proposed elsewhere

For our projects, therefore, only the following proposals by Per Bothner
and RMS seem appropriate:

> #2a:  Instead of just tokenizing each header file, we store
> a pre-compiled version that actually contains tree nodes
> in the binary format of the host system.  For example,
> the 'struct pair' would contain a struct tree_type in the
> actual pre-compiled file.

> #3 Only scan certain definitions if they are needed in the actual
> program.  I don't remember how this was done.  However, we could
> do something like spit the header file into section, one for
> echo declaration/definition (macro, extern, class, ...), and for
> each section specify the names it provides definitions for.
> Then lazily scan those sections when needed.

(The latter is probably less optimal, but certainly simpler to implement.)


In any case, precompiled headers are a Good Thing (TM) and we would very
much appreciate any work in that direction. Thanks in advance!

Regards
  Wolfgang


-------------------------------------------------------------------------
Wolfgang Bangerth          email: wolfgang.bangerth@iwr.uni-heidelberg.de
                             www: http://gaia.iwr.uni-heidelberg.de/~wolf



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