My two cents

Atila Neves atila.neves at gmail.com
Mon Oct 23 12:56:39 UTC 2017


On Monday, 23 October 2017 at 11:02:41 UTC, Martin Nowak wrote:
> On Monday, 23 October 2017 at 06:05:50 UTC, drug wrote:
>> 20.10.2017 17:46, Martin Nowak пишет:
>> My 2 cent:
>> 1. dub needs ability to work with other repository than 
>> standard ones.
>
> You mount or clone whatever you want and use `dub add-local`.
>
>> 2. multicore building - entire project in D builds faster than 
>> C++ one (I have two implementation of the same), but in case 
>> of incremental building C++ faster.
>
> I always assumed this to be the main point why people are 
> asking for a better build tool, but it's not sth. dub can do 
> atm. It's a limitation of the compiler that requires various 
> changes and a slight redesign of our build model.

Does it? Reggae can do parallel per-package builds (in fact, the 
default) right now.

> In C++ incremental rebuilds are simple as you compile each file 
> individually anyhow, but that's the crux for why C++ 
> compilations are so slow in the first place.

Not really. C++ is slow to compile anyway because parsing it is 
slow. C has the same compilation model and is much much faster to 
compile than C++. There's also the fact that the same headers are 
parsed over and over again. `#include <iostream>` requires 
parsing thousands of lines of code from dozens of files.

However, if all you touched was a C++ implementation file, then 
incremental builds are faster than D. Really.

> Compiling multiple modules at once provides lots of speedups as 
> you do not have to reparse and analyze common/mutual imports, 
> but on the downside it cannot be parallelized that well.

I measured, and indeed compiling per package is faster than 
compiling all of the modules that have to be recompiled 
individually, even if done in parallel. Weirdly enough this is a 
disadvantage (time-wise) of having implementation and 
declarations in the same file.

> Dub could parallelize building individual packages/sub-packages 
> (target + dependencies) right now though.

reggae already does, just point it at a dub package directory. By 
default it'll even build the default target and a unittest one in 
parallel.

>
>> 3. dub single build mode does not caches builds so it builds 
>> entire project every time.
>
> Could you please file an issue with a test case for that.
> Why do you use single build mode in the first place?

I'd assume it'd be to only rebuild the necessary files C++-style. 
However, and as stated by you above, that's usually slower anyway.

Atila


More information about the Digitalmars-d mailing list