This is the mail archive of the
mailing list for the GCC project.
Re: How would *you* use an intern?
- To: Stan Shebs <shebs at apple dot com>
- Subject: Re: How would *you* use an intern?
- From: Carlo Wood <carlo at alinoe dot com>
- Date: Thu, 31 May 2001 01:59:46 +0200
- Cc: gcc at gcc dot gnu dot org
- References: <3B156B14.11A07A4A@apple.com>
On Wed, May 30, 2001 at 02:50:12PM -0700, Stan Shebs wrote:
Perhaps too difficult, but would it be possible for him to look
into precompiled header files?
What I am thinking of is actually rather simple, let me explain:
When a compilation unit is compiled, header files tend to generate
code (certainly with all these templates these days), this code
is the same for each compilation unit if the values of all macros
that are involved in the generation of this code is the same.
Therefore, a little database could be build during compilation
in which code generated by headerfiles is stored as function of
1) the name of the header file
2) a headerfile checksum
3) the macro signature that are relevant
I imagine that this could be stored in the filesystem as:
where 'data-file' contains:
1) the checksum of the headerfile at time of generation.
2) all macros that are used in the headerfile and their definition.
Both can be generated during the preprocessing phase.
If during the compilation of a compilation unit a new header file
is preprocessed and there turns out to exist a corresponding
precompiled headerfile with the same checksum and macro signature,
then there is no need to compile it again.
In the case of templates there is one more level; the template
parameter types used. Code generated for templates can therefore
probably best be stored one level deeper in the file system, ie:
where the "mangled-template-name" ensures we talk about a template
with all template parameters fixed.
Imho, this would speed up compilation C++ projects by a factor of 10
or more. Consider a project that uses a .cc file per class, but
each file includes <iostream> and <string>. These header files take a
few seconds to compile, while the .cc file in itself can be small and
only take a fraction of a second.
Carlo Wood <email@example.com>