Bald: the world’s fastest linker

Today I announce the release of Bald: the world’s fastest linker for Linux, macOS and Windows. Bald offers dramatic speedups over existing linkers in two ways:
- Incremental linking. Much like how your compiler does not build everything from scratch each time, incremental linking reuses work from previous links. Most linkers don’t offer this, because it is difficult.
- Faster full links. Even with incremental linking disabled, Bald beats all competitors by substantial margins.
Cold link benchmarks
| Format | Bald speedup | Benchmark |
|---|---|---|
| ELF | 1.56× vs Mold | 7 Linux application links |
| Mach-O | 1.62× vs Apple ld, 2.52× vs ld64.lld |
14 macOS links |
| PE/COFF | 1.3× vs RAD, 1.8× vs LLD | 6 Windows applications |
| WebAssembly | 4.84× vs LLD, 1.72× vs Wild | 49 workloads vs LLD and 36 vs Wild, at 8 threads |
These results were measured natively, i.e. Mach-O was benchmarked on macOS and PE was benchmarked on Windows Server.
Headline results for a linker leave out a lot of variance across workloads, but Bald beats the competition on every workload benchmarked so far.
Why do this?
Build times have always been a drag on developer productivity, but the bottleneck is far more pronounced now that AI writes the code faster than any human. Amdahl’s Law and so on.
Linking is only a part of the build process, but it is usually a quite significant cost, especially when iterating on debug builds.
(If you don’t know what a linker is and you’re still reading, it’s the program that takes the compiler’s output and turns it into an actual executable file. This is harder than it sounds.)
Despite their importance, linkers don’t have enough people working on them. They are unglamorous and unpleasant because of how many edge cases and underspecified behaviours they contain. There are perhaps a handful of linker experts in the world, and to be perfectly candid, I am not one of them.
However, the existing linkers are open source and their APIs are ossified, so we have great oracles for testing. All this makes for the kind of project where one person working carefully with AI can deliver dramatic improvements.
The above is a retrospective justification. In reality, I did this mainly because I thought it would be easy.
Lessons learned
Unfortunately, AI was not yet good enough to one-shot the world’s fastest linker, so I have learned some things in the process:
- Linking is many different tasks under one umbrella. Different builds will require very different work from the linker, so a lot of the optimisation challenge is about being fast on every workload and not just optimising for one case.
- Optimising for multiple platforms is slow and expensive. It took a few months to get to this release, and the biggest bottleneck was running benchmarks. I think it could have been done in a month or less if I had been working full-time on Bald, though I reckon that would have entailed a monthly server bill as high as $10k. Benchmarks need to run on a variety of machines and operating systems, and you can’t really do anything else on the box while a benchmark is running.
- Software is cursed and all existing linkers have rare but serious bugs. Even if you use an old and boring linker, you might one day build a program that the linker has broken in a catastrophic fashion.
What next?
Please use Bald and contribute if you have something worthwhile. Here are the kinds of contributions Bald needs:
- Finding correctness issues that affect real builds
- Improving performance
- Identifying situations where a competitor is faster
- Identifying cases where incremental linking is regrettable for performance
You do not need to be knowledgeable to contribute, but you need to be conscientious. Slop will get a block. AI-generated contributions are not necessarily slop. This is determined by the Potter Stewart test: I know it when I see it.
Happy linking!