A brief survey of build tools, focused on D

GoaLitiuM goalitium at goalitium.goalitium
Mon Dec 10 21:53:40 UTC 2018

I switched away from dub to meson for my small game engine 
project, and the biggest benefit of this switch was the improved 
build times while doing small iterations to some files:

dub build --arch=x86_64 --build=debug --compiler=dmd
- full rebuild: 3960ms
- touch file1 and build: 2780ms
- touch file2 and build: 2810ms

ninja -c build
- full rebuild: 10280ms (includes some dependencies like ErupteD 
and SDL2 bindings)
- touch file1 and build: 1410ms
- touch file2 and build: 250ms

The results for touching second file seems like an anomaly to me, 
but in practice the incremental build times are around the same 
with touching the first file, so that is already 2x improvement 
with incremental build times. If I touch multiple files, ninja 
can invoke multiple build commands at the same time so the work 
gets distributed along all the processor cores so the build time 
does not change a lot from editing one file (which does not seem 
to reflect in your build timing results for some reason?).

But as you mentioned in the article, there are some caveats with 
this, mainly the lack of dependency graph which may cause some 
weird bugs in the program if you drastically change one module or 
work with templates. You also have to make sure the dependencies 
are built with the same compiler, which could explain the 
headache #3 in your article.

The comparison and some of the other headaches with meson does 
not seem to be fair as you are comparing dub, which is both a 
build system and a package manager, to meson which is only a 
build system, you have to make sure all the dependencies are 
installed to your system beforehand. While I agree with the 
headache #1, other headaches are simply due to you not using 
meson the way it was intended to.

More information about the Digitalmars-d-announce mailing list