Build all at once or…

Jonathan M Davis jmdavisProg at gmx.com
Sun Dec 22 01:03:25 PST 2013


On Sunday, December 22, 2013 08:21:34 Russel Winder wrote:
> There seems a dichotomy between "explicitly compile each d file (aka
> module) and then link" versus "compile all the files (aka modules) at
> once" especially since the objects for each file/module are created in
> both cases.
> 
> I am assuming there are also some DMD/GDC/LDC2 differences as well.
> 
> Currently Dub is "compile all source at once" and SCons is "compile each
> file individually and then link" (though I am currently using SCons in a
> "compile all source at once" as an experiment to see what needs to
> happen to the SCons D build support.
> 
> Is there some critical feature which means that "compile all source at
> once" is a better route?

1. Unless you compile each of the separate files in parallel, it's faster to 
compile everything at once, because you avoid having to reprocess all of the 
imported modules. Parallel compiling still has to do all of that work, but the 
gains from compiling multiple at the same time will likely offset it.

2. As I understand it, there's at least one outstanding bug where the symbols 
can get screwed up if you build stuff separately. Unfortunately, I don't 
remember the details or the bug number, but it's generally brought up when 
anyone tries to promote doing incremental builds.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list