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

James Lu jamtlu at gmail.com
Tue Feb 23 14:41:59 UTC 2021


Linking is the slowest part of D's compilation process. It is 
what makes its compilation speed uncompetitive with interrpreted 
scripting languages like Python and JavaScript.

This project to make a faster linker is in alpha: 
https://github.com/rui314/mold

> Concretely speaking, I wanted to use the linker to link a 
> Chromium executable with full debug info (~2 GiB in size) just 
> in 1 second. LLVM's lld, the fastest open-source linker which I 
> originally created a few years ago, takes about 12 seconds to 
> link Chromium on my machine. So the goal is 12x performance 
> bump over lld. Compared to GNU gold, it's more than 50x.

> It looks like mold has achieved the goal. It can link Chromium 
> in 2 seconds with 8-cores/16-threads, and if I enable the 
> preloading feature (I'll explain it later), the latency of the 
> linker for an interactive use is less than 900 milliseconds. It 
> is actualy faster than cat.


More information about the Digitalmars-d mailing list