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

Atila Neves atila.neves at
Fri Feb 26 13:23:06 UTC 2021

On Wednesday, 24 February 2021 at 23:53:34 UTC, deadalnix wrote:
> On Wednesday, 24 February 2021 at 22:12:46 UTC, Atila Neves 
> wrote:
>> On Tuesday, 23 February 2021 at 14:41:59 UTC, James Lu wrote:
>> 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.
> This is true for a fresh build, but often not the case for 
> incremental builds, which dev often have to go through.

I only really care about incremental builds. Fresh builds should 
be rare, and if they're not, I don't understand that workflow.

> This is because the work you have to do for sources grows with 
> the size of the changeset, while the work you have to do link 
> grows with the size of the project as a whole, changed or not. 
> On large projects, it is very common that linking dominates 
> incremental builds.

It can, yes, and any improvements there will be very welcome.

> zld is another interesting project that tries to do enable 
> incremental linking:

Nice. I wrote a D program once that used the linker as a server 
and kept "sending" it object files that it kept on relinking, but 
unfortunately that didn't speed anything up.

More information about the Digitalmars-d mailing list