DUB build questions

Rikki Cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 22 05:08:08 PST 2014


On 23/12/2014 1:39 a.m., uri wrote:
> On Saturday, 20 December 2014 at 08:36:15 UTC, Russel Winder via
> Digitalmars-d-learn wrote:
>>
>> On Sat, 2014-12-20 at 05:46 +0000, Dicebot via Digitalmars-d-learn wrote:
>>> On Saturday, 20 December 2014 at 04:15:00 UTC, Rikki Cattermole wrote:
>>> > > b) Can I do parallel builds with dub. CMake gives me > >
>>> Makefiles so I can
>>> > > make -j does dub have a similar option?
>>> > > No
>>>
>>> Worth noting that it is not actually a dub problem as much, it is
>>> simply not worth adding parallel builds because separate
>>> compilation is much much slower with existing D front-end
>>> implementation and even doing it in parallel is sub-optimal
>>> compared to "dump-it-all-at-once".
>>
>>> From previous rounds of this sort of question (for the SCons D
>> tooling), the consensus of the community appeared to be that the only
>> time separate module compilation was really useful was for mixed D, C,
>> C++, Fortran systems. For pure D systems, single call of the compiler
>> is deemed far better than traditional C, C++, Fortran compilation
>> strategy. This means the whole "make -j" thing is not an issue, it
>> just means that Dub is only really dealing with the "all D" situation.
>>
>> The corollary to this is that DMD, LDC and GDC really need to make use
>> of all parallelism they can, which I suspect is more or less none.
>>
>> Chapel has also gone the "compile all modules with a single compiler
>> call" strategy as this enables global optimization from source to
>> executable.
>>
>
> Thanks for the info everyone.
>
>
> I've used dub for just on two days now and I'm hooked!
>
> At first I was very unsure about giving up my Makefiles, being the build
> system control freak that I am, but it really shines at rapid development.
>
> As for out of source builds, it is a non-issue really. I like running
> the build outside the project tree but I can use gitignore and
> targetPath. For larger projects where we need to manage dependencies,
> generate code, run SWIG etc. I'd still use both SCons or CMake.
>
>
> Regarding parallel builds, make -j on CMake Makefiles and "dub build"
> feel about the same, and that's all I care about.
>
> I'm still not sure how dub would scale for large projects with
> 100s-1000s of source modules. DMD ran out of memory in the VM (1Gb) at
> around 70 modules but CMake works due to separate compilation of each
> module ... I think. However, I didn't investigate due to lack of time so
> I wouldn't score this against dub. I am sure it can do it if I take the
> time to figure it out properly.
>
> Cheers,
> uri

To build anything with dmd seriously you need about 2gb of ram 
available. Yes its a lot, but its fast.
Also use subpackages. They are your friend.


More information about the Digitalmars-d-learn mailing list