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

Max Haughton maxhaton at gmail.com
Wed Feb 24 20:58:48 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. 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.

This project is definitely worth watching, but it's worth saying 
that people continuously try and make their compiler the fastest, 
or their linker the fastest etc - progress is always good, but 
these things tend to slow down quite a bit as they mature.


More information about the Digitalmars-d mailing list