r/cpp 8d ago

mold: A Massively Parallel Linker

https://arxiv.org/abs/2608.23228
183 Upvotes

25 comments sorted by

95

u/Wetmelon 8d ago

Curious why this paper comes out now, 6 years after mold's debut. I guess it's for a degree lol, fair enough

34

u/AspiringMechKeebFan 8d ago

It's for a conference talk Ryu will be doing soon.

1

u/[deleted] 2d ago

[deleted]

3

u/rui 2d ago

It's me

54

u/meltbox 8d ago

Very cool but as expected LTO cannot be parallelized like the rest. Still a big win.

5

u/QBos07 5d ago

Lto is a multi stage process and pets if it can actually be parallelized.

22

u/OCPetrus 7d ago

I'm using mold for the past year or so. When I switched I measured the compile time of my builds and it was large enough that the switch was warranted. The only problem I've encountered using mold instead of the default gcc linker is that error messages aren't as descriptive. The developer acknowledged this at a FOSDEM talk he held and I assume the messages will improve over time.

13

u/read_volatile 8d ago edited 8d ago

I'd be curious to hear /u/rui's insights on wild linker, even without incremental linking support (a feature unique to only MSVC and soon wild) it seems to beat Mold in speed and ram usage by a huge margin

Edit: and apparently its featureset has caught up to mold's, so it's not simply a matter of "doing less stuff"

15

u/rui 7d ago

I ran wild on the same benchmark suite I used in the paper. It looks like mold outperforms wild by a healthy margin. Also, wild couldn't link a few of the programs in the benchmark suite. But I'm honestly curious about their claim that wild is much faster than mold. Maybe that's true on some machines. I'll investigate and update our docs with the results.

3

u/13steinj 6d ago

I personally struggle to understand the value of wild/incremental linking. But maybe that's because my compile times massively exceed the link times.

0

u/CocktailPerson 5d ago

The value of wild is that it's faster even without linking incrementally.

If your build isn't very incremental, then obviously incremental linking won't help.

3

u/amoskovsky 5d ago

1) wild benchmarks run on tmpfs rather on real storage (disk writing patterns matter a lot)

2) no huge pages mentioned, so I guess they are disabled which pessimizes mold.

3) the mold paper shows thread scaling data; no such data for wild

4) from wild benchmarks, mold shows perf improvements with next versions, but wild shows perf degradation. Who knows what will be the perf when wild finally supports everything mold supports

2

u/13steinj 5d ago

Faster than mold?

0

u/CocktailPerson 5d ago

There's a link in the comment you replied to.

2

u/13steinj 4d ago

Maybe I'm blind. Maybe it was editted in.

I'll wait and see for rui's investigation (and benchmark myself) but non-incremental linking being faster than mold would be a surprise.

6

u/rui 4d ago

I ran the benchmark, and mold was indeed faster than wild, at least on the two machines I tested. See https://github.com/rui314/mold#benchmark for details.

11

u/Moldoteck 8d ago

Ehhh, waiting for it to be available on windows too... For now sticking with lld

17

u/t_hunger 8d ago

Ist nice to see people working on linkers again with lld, wild and mold.

Maybe one of them will eventually grow some extension to help with (some of) the ODR problems we have. That would be a great help for contracts and probably profiles as well as those evolve.

11

u/vip17 8d ago

it was stable 5 years ago https://www.reddit.com/r/cpp/comments/rh3hue/mold_10_the_first_stable_and_productionready/ so I was surprised to see a new paper on this

3

u/Pythonic_programer 7d ago

The new linker on the street is wild 😉

2

u/starfreakclone MSVC FE Dev 3d ago

https://github.com/wild-linker/wild/blob/main/libwild/src/args/coff.rs#L174 -- am I reading this right, wild doesn't support /OPT:ICF?

1

u/_Ilobilo_ 7d ago

doesn't support linker scripts

4

u/matthieum 7d ago

Is it by design, or just a matter of time/effort?

2

u/_Ilobilo_ 7d ago

by design iirc

1

u/Quiet_Violinist_2978 1d ago

Is this new? I thought parallel linking was already a thing

1

u/t_hunger 2d ago

Rust is really taking over the tooling of all kinds of languages: https://archive.is/yV10S