Practical parallelization of D compilation

Guillaume Lathoud gsub at glat.info
Wed Jan 15 17:16:46 UTC 2020


Concerning the first (fresh) compilation:

On Wednesday, 8 January 2020 at 13:14:38 UTC, kinke wrote:
> [...] you can also try to compile all modules at once, but 
> output separate object files - `ldc2 -c a.d b.d c.d`.

I just had another try at `ldc2 -c ...`. It does work when 
grouping the files in chunks of say 50.

So now I could parallelize the first (fresh) compilation using 
that chunk approach, and this leads to compilation times 
comparable to, or even faster than the single-process approach 
`ldmd2 -i main.d`.

real time:
  * 4-core: 57 seconds with chunks instead of 52 seconds with the 
single-process approach
  * 8-core: 23 seconds with chunks instead of 33 seconds with the 
single-process approach

So the drawback of this approach has pretty much disappeared, at 
least on my 200 files :)
Thanks a lot for all the feedback!

Guillaume



More information about the Digitalmars-d-learn mailing list