This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Re: reduce compilation times?


On 2007/11/27, Tom St Denis <tstdenis@ellipticsemi.com> wrote:
> This is why you should re-factor your code as to contain only one [or as
> few as possible] exportable functions per unit.
>
> If you write an entire 100K line program as "main.c" of course you'll be
> hit by slow compiles.
>
> But if you factor the code you can get good savings.  For instance, one
> of my OSS projects (if you know who I am you know what I'm talking
> about) is ~50K lines and compiles in ~29 seconds on a pentium 4.  It
> builds in 8 seconds a quad-core Intel Core2.  For most files [units] I
> only have one function, so the line count per file is on average ~200 or so.

It's good idea, "to refactorize the code" and "to split many functions
to many files"
(e.g. one file per one function) with the objective of re-compile-time reduction
(many compiled objects don't need to be recompiled).

GCC needs LTO (Link Time Optimization), too.

   J.C.Pizarro


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