On 04/10/2017 02:41 PM, Matthias Klumpp wrote:
> On Monday, 10 April 2017 at 12:10:41 UTC, Russel Winder wrote:
>> On Mon, 2017-04-10 at 08:39 +0000, Atila Neves via Digitalmars-d-
>> announce wrote:
>>> As far as I know the only build system that does this by default for
>>> D is reggae.
>> I will be adding a new builder to the SCons D tools to do whole source
>> and per package compiling – to add to the module at a time compiling.
>> It would be good to add this for CMake-D and the D support in Meson.
> I am not buying the necessity of not-splitbuilding for optimizations
> yet. If that would be the case, how do optimizations work with projects
> using GCC/Clang where splitbuilding is the default and often only option
> (like Mesa, Linux, lots of scientific stuff).
The argument is not so much about optimization (which can be obtained
via LTO as well), but primarily about build speed.
Turns out that recompiling 10 modules at once (a whole package) is often
faster than doing 3 single-module compilations when each of the 3
modules imports the same 4 modules.
10 < 3 + 3 * 4
Sure the latter is parallelizable, but a lot of computation is wasted
repeating the same work.
dmd has another build mode `-c` with multiple source files producing
multiple object files, but that mode is fundamentally broken, b/c
template instances are only emitted to one of the object files, leading
to funny linker errors when rebuilding only some modules.
We kinda know how to fix this (without resorting to `-allinst`), but
it's a lot of work, and splitting into subpackages simply works, is
fast, and can be parallelized as well.