Build all at once or…

Jonathan M Davis jmdavisProg at gmx.com
Sun Dec 22 05:13:13 PST 2013


On Sunday, December 22, 2013 10:44:15 Russel Winder wrote:
> On Sun, 2013-12-22 at 01:03 -0800, Jonathan M Davis wrote:
> […]
> 
> > 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.
> I can see this being so where many files are changed between builds, but
> I am working in a situation where I want to build and run after each
> change of a file. So with large numbers of files only compiling one and
> linking seems faster than compiling all.

Possibly, but dmd is so fast that the linking portion is often what takes the 
longest, so I wouldn't even worry about separate compilation until I had a 
very large project. I wouldn't expect any real gain for smaller projects, and 
it's definitely the case that the compiler has to do more work when compiling 
each file separately, so without parallelizing builds, I fully expect that 
incremental compilation will be slower until a project gets fairly large. But 
you'd have to experiment to figure out what the exact performance 
characteristics are.

> > 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.
> 
> It would be good to uncover this one in more detail as the current SCons
> build strategy is always separate compilation. If anyone can add to
> Jonathan's point here, that would be great.

Searching for posts on incremental compilation in the newsgroup will likely 
turn it up fairly quickly. But when you add that bug on top of the fact that 
incremental compilation is unlikely to garner much in the way of performance 
gains except for larger projects, I never bother with incremental compilation 
at this point and wouldn't bother with it until compilation times were getting 
large.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list