Subject: Re: Kernel compile 100 times faster (this sound provocating,doesnt it?:)
To: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
From: Michael L. VanLoon -- HeadCandy.com <michaelv@HeadCandy.com>
List: current-users
Date: 02/02/1996 23:36:07
>> When compiling a currentkernel on a 030/25Mhz this can need many hours.
>> Most of the time is wasted in including the same files.

>What basis do you have for this statement?  In my experience, the
>preprocessor is a relatively small fraction of the total time for a
>compile.  (I usually run the compiler in a way that, among other
>things, lets me see when each phase of the compilation begins.)

I would think the buffer cache would do an adequate job of holding on
to those repetitively referenced files.  At least I would hope so.

>> I imagine to speed up this by joining all C-Sources by a script used
>> instead of gcc [...] and cating this to one file.  After this
>> multiple includes should be removed and the whole file feed to gcc.

>- Suddenly, "static" no longer restricts a declaration's visibility to
>   just the file it appears in.  I don't know whether there are
>   actually any conflicts between statics in one file and statics in
>   another, but there certainly could be.
>- Many files #define things, like manifest constants, and then leave
>   them defined forever, letting the definitions die at the end of the
>   compilation unit.  Your scheme would have to arrange for things to
>   be #undeffed on occasion to prevent conflicts between one file's
>   private #defines and another's.

This reminds me of "precompiled headers".  The Microsoft C++ compiler
has excellent support for precompiled headers.  And, from someone who
rebuilds large projects on a regular basis, I can tell you that they
cut down on compile time immensely (especially with all the scattered
about include files that Win32, MAPI, and all their APIs suck in).

I think it's way out of the scope for any of the NetBSD teams to
create a header precompiler for GNU cc or c++.  But it would be a
really cool thing for someone to work on in cooperation with the GNU
folks.

-----------------------------------------------------------------------------
  Michael L. VanLoon                                 michaelv@HeadCandy.com
       --<  Free your mind and your machine -- NetBSD free un*x  >--
     NetBSD working ports: 386+PC, Mac 68k, Amiga, HP300, Sun3, Sun4,
                           DEC PMAX (MIPS), DEC Alpha, PC532
     NetBSD ports in progress: VAX, Atari 68k, others...
-----------------------------------------------------------------------------