Linking is the slowest part of D's compilation process– can we use mold to speed it up?

Atila Neves atila.neves at gmail.com
Wed Feb 24 22:12:46 UTC 2021


On Tuesday, 23 February 2021 at 14:41:59 UTC, James Lu wrote:
> Linking is the slowest part of D's compilation process.

Not necessarily:

/tmp % cat foo.d
import std.uni;
void main() {}
/tmp % time dmd -c -unittest foo.d
dmd -c -unittest foo.d  0.27s user 0.06s system 99% cpu 0.331 
total
/tmp % time dmd foo.o
dmd foo.o  0.04s user 0.05s system 154% cpu 0.058 total


I'm using lld as the linker.

The linker can be a bottleneck, yes, especially since it doesn't 
do work in parallel. But in my experience, if the linker takes a 
while, compiling took a lot longer still. Of course, any 
improvements in this area are welcome, and I hope mold is 
production-ready as soon as possible.

I recently bought an NVMe drive just in the hope that it'd help 
with the "linker tax".



More information about the Digitalmars-d mailing list