On Mon, Mar 04, 2013 at 09:25:02PM +0100, Marco van de Voort wrote:
> In our previous episode, Henry Vermaak said:
> > > > I just add all the objects to a variable in a Makefile.
> > > > 
> > > > The result is that I have a 27000 line c library that compiles in *half*
> > > > the time it takes to compile a 4000 line lazarus program because my c
> > > > lib can be built with make -j 9.
> > > 
> > > I'm not exactly sure what this proves. The C situation is not equivalent 
> > > to
> > > the Pascal situation, the latter trying to make sure all (Pascal level
> > > symbols) are there before the linker.
> > 
> > What I'm trying to say is that gcc is going 3 times faster on my quad
> > core machine because of the build system, not because they've turned
> > their compiler into a multi-threaded clusterfsck.
> 
> IMHO a threading clusterfsck is preferable to a forking clusterfck :-)

My gut feeling would be that the complexity and potential bugs/races
don't make up for the speed, but maybe a threaded compiler gains a lot
more than I imagine.  Are there any multi-threaded compilers around for
comparison?

> Yes. But is that incremental? It is fun to speed up a full build, but in
> reality developers are more likely to do a partial one. Ever pressed F9
> after a small change in Delphi? The app starts nearly immediately, if
> the change wasn't too deep in the hierarchy of dependencies.
> 
> But compilation units in C have weaker(no) coherence than in (modular) 
> Pascal, and C does
> not have an auto build system. All dependencies are done manually.
> (sometimes assisted with semi automated tools)
> 
> This means you need to manually specify in the build system which
> compilation unit depends on which headers. And this is also why in C/C++
> inline functions are in the header, so that this model is persistent, since
> most builds are not full, but incremental.

As you probably know, you can use -MD and variants with gcc, which
outputs dependency files for make, that you then include in the
Makefile.  If you add, e.g. -MMD to the CFLAGS, these dependencies are
generated as a side effect of the compilation process, so it's not a
separate step.  As a result, partial builds work really well, and can be
parallelized as usual.  No manual work involved.

Henry
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to