Linking is the slowest part of D's compilation process– can we use mold to speed it up?
FeepingCreature
feepingcreature at gmail.com
Thu Feb 25 12:43:21 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.
I've run a quick internal test with a 34MB object.
gold: 0.82s
mold: 0.20s
That's pretty amazing. Of course, it took a lot of poking at
linker flags to make it happen, and I had to change hash style
cause its gnu hash impl is pretty slow right now (0.6s). But
still.
More information about the Digitalmars-d
mailing list