llvm-ld link speed

How long a link takes, and where llvm-ld saves the time, right now. Every number is a paired A/B measured in one run on one machine: llvm-ld as it is built to be fast (the link-speed patches plus PGO, ThinLTO and BOLT, via tools/pgo_build.py) against stock lld from the same LLVM 23.1.0 payload before the link-speed patches, built plain (-O3), linking the same corpora interleaved. Both factors are in the numbers: the source patches speed up PDB emission, and PGO + BOLT speed up everything, including LTO codegen. Hosted runners are shared and noisy, so times are only compared within a run, never across runs.

Every cell is gated on byte-identical output: the candidate's EXE (and PDB, when the variant writes one) match the baseline's exactly, and both are self-deterministic. A speedup that changes output bytes is a bug, not a result.

Link time, and what the PDB adds

Link time of stock lld-link and llvm-ld by build type and corpus size, split into the link itself and the extra time the PDB adds

Each corpus is linked twice with the same objects, once per variant, so the hatched segment is only the PDB's extra time:

Build types:

All cells

BuildVariantCorpusThreadsRunsSaved (IQR) llvm-ld msStock msCPUPeak RSSEXEPDB
Debuglinksmall · 64 objects19+25.9% (+23.6..+26.4)6.99.2-26.3%+0.0%aa441509b521none
Debuglink + PDBsmall · 64 objects19+31.3% (+30.4..+32.6)21.431.0-32.0%+0.0%446520dc5290e745d5b749a3
Debuglinksmall · 64 objects29+23.5% (+22.7..+23.8)7.49.7-22.6%+0.0%aa441509b521none
Debuglink + PDBsmall · 64 objects29+36.4% (+35.1..+39.0)18.829.1-28.3%+0.0%b15b1c8b34552041beccb8fc
Debuglinksmall · 64 objects49+23.4% (+23.0..+26.4)7.610.2-24.1%+0.0%aa441509b521none
Debuglink + PDBsmall · 64 objects49+37.1% (+36.8..+37.9)17.427.7-26.4%+0.0%c44f31d753d657afdf8e99c4
Debuglinkmedium · 512 objects19+31.0% (+30.7..+32.0)49.070.9-31.3%+0.0%6f1849fff359none
Debuglink + PDBmedium · 512 objects19+34.8% (+34.6..+35.2)209.1320.9-35.6%-1.9%d8421139beb60e609754a0fe
Debuglinkmedium · 512 objects29+31.9% (+31.0..+32.2)48.370.5-30.5%+0.0%6f1849fff359none
Debuglink + PDBmedium · 512 objects29+41.6% (+39.7..+42.6)165.8277.8-29.4%-2.4%67d4175aac1aa4a6039426ad
Debuglinkmedium · 512 objects49+32.2% (+31.2..+32.5)45.066.1-29.5%+0.0%6f1849fff359none
Debuglink + PDBmedium · 512 objects49+45.6% (+44.9..+45.9)140.6258.2-28.1%-2.3%e525f9a8acae4d6a0cd9b7f2
Debuglinklarge · 2048 objects19+29.4% (+28.6..+30.3)277.5390.9-29.1%-2.0%3cba4e41ea8bnone
Debuglink + PDBlarge · 2048 objects19+33.5% (+33.2..+34.1)1171.81765.3-34.0%+3.5%b6d6ac8ffcf8763e176be9f6
Debuglinklarge · 2048 objects29+33.5% (+31.7..+33.9)245.2367.0-28.6%-2.0%3cba4e41ea8bnone
Debuglink + PDBlarge · 2048 objects29+43.6% (+41.3..+44.3)830.21468.8-31.2%+4.1%3f5fc5d21afca9cfea89d5f6
Debuglinklarge · 2048 objects49+33.0% (+32.5..+33.3)227.3340.9-25.8%-2.0%3cba4e41ea8bnone
Debuglink + PDBlarge · 2048 objects49+48.4% (+47.8..+49.3)699.01345.0-25.6%+4.1%68c45d203be73526317dd534
Releaselinksmall · 64 objects19+14.5% (+12.8..+19.1)5.86.8-15.1%+0.0%08b3db4df8fenone
Releaselink + PDBsmall · 64 objects19+34.1% (+32.2..+36.0)13.921.8-36.3%+0.0%6eaa9d0067f5cb37b3dec35d
Releaselinksmall · 64 objects29+14.7% (+13.1..+17.7)6.07.2-14.7%+0.0%08b3db4df8fenone
Releaselink + PDBsmall · 64 objects29+35.0% (+32.4..+36.5)14.021.3-27.9%+0.0%0676493d4d4060144d6aedbc
Releaselinksmall · 64 objects49+13.8% (+12.7..+15.6)5.86.8-13.6%+0.0%08b3db4df8fenone
Releaselink + PDBsmall · 64 objects49+35.5% (+33.4..+36.5)12.419.2-26.5%+0.0%fb418a51cc2b8c914751050c
Releaselinkmedium · 512 objects19+12.6% (+7.7..+14.4)46.152.4-14.6%+0.0%297950d80255none
Releaselink + PDBmedium · 512 objects19+26.0% (+24.0..+26.9)217.9296.0-36.8%-3.9%751a10a9736e4c62a10b0b0f
Releaselinkmedium · 512 objects29+18.8% (+15.8..+19.3)42.149.8-14.5%+0.0%297950d80255none
Releaselink + PDBmedium · 512 objects29+26.6% (+25.9..+32.1)197.0278.9-31.8%-4.5%928984f526b3c04b519481b9
Releaselinkmedium · 512 objects49+7.1% (-0.0..+14.2)47.847.9-13.5%+0.0%297950d80255none
Releaselink + PDBmedium · 512 objects49+27.7% (+27.2..+35.2)179.5253.7-29.8%-4.6%5f0cc5680337ab3348a7339a
Releaselinklarge · 2048 objects19+10.2% (+6.5..+12.2)389.3435.2-18.1%-2.5%b1cb1d1fbe6enone
Releaselink + PDBlarge · 2048 objects19+22.1% (+18.8..+23.0)1440.01859.4-38.3%+1.9%de4fddd3c1af7b11c97330f9
Releaselinklarge · 2048 objects29+10.5% (+9.9..+11.4)344.2388.7-15.2%-2.5%b1cb1d1fbe6enone
Releaselink + PDBlarge · 2048 objects29+24.6% (+22.7..+26.4)1269.81691.1-33.2%+1.1%7d0e68c43d0530c9d57e1a24
Releaselinklarge · 2048 objects49+12.0% (+10.0..+12.8)338.1380.1-15.9%-2.5%b1cb1d1fbe6enone
Releaselink + PDBlarge · 2048 objects49+24.7% (+22.7..+26.7)1191.61610.1-27.6%+1.1%29b75132964a5302e7a17a95
ThinLTOlinksmall · 64 objects45+43.0% (+42.9..+43.2)9267.116421.3-43.7%+0.0%c245d815f4fanone
ThinLTOlink + PDBsmall · 64 objects45+43.3% (+43.3..+43.5)9299.316456.7-43.3%+0.0%6dea2953bc4599aaae384cbd

Scope and caveats

Thread counts measured this run: 1, 2, 4. The workflow measures 1, 2 and 4 threads plus the runner's core count (4) when that is larger than 4; the chart shows each build type at its highest, 4 threads here. The headline +46% in the project notes was measured at 16 threads on a local workstation; this run's highest thread count cannot reproduce that regime, so the speedup at 4 threads is expected to be smaller.

ThinLTO is measured on small at the highest thread count only: the link runs LLVM codegen, which the patches do not touch. Only small is measured: one medium ThinLTO link takes ~2 minutes even on 16 cores.

Allocator: on Linux the benchmarked llvm-ld-direct allocates through glibc malloc, because MI_MALLOC_OVERRIDE is defined only for WIN32 builds in CMakeLists.txt. The shipped Windows DLL allocates through mimalloc. These are parallelisation patches, and allocator behaviour under thread contention differs between glibc arenas and mimalloc.

Measured on Linux; the shipping target is Windows. That the relative speedup transfers to Windows is asserted, not measured: no Windows run of this paired ratio has been published yet, and at least one optimised phase is known to diverge (createFutureForFile is std::launch::deferred on Linux and std::launch::async under _WIN64).

Provenance

Run 40469845631 attempt 1; source fed92e11c7c51d612714890b2fcd19d4ebd35525; baseline f9cdd65cbfb5f64654ce428524a8126652bed8a7 (stock lld: the payload before the link-speed patches, plain -O3 build).

Runner Ubuntu 24.04.5 LTS, AMD EPYC 7763 64-Core Processor / AMD EPYC 9V45 96-Core Processor, 4 cores, kernel 6.17.0-1022-azure; fingerprint 94b545756d982eea4820bda6205fd3706e5afd025dbc0e6ff55490e0a968b9a8.

Actions run

Reproduce

python tests/perf/gen_corpus.py --out build-perf/corpus --mode release --profile large
python tests/perf/bench.py --candidate build/llvm-ld-direct --baseline build-perf/baseline/llvm-ld-direct --corpus build-perf/corpus/release/large --variant pdb --threads 4 --runs 9