Repository navigation
Description
Summary
Extend the frozen link-corpus benchmark (#55) with three link modes so we get excellent coverage of the real dev-vs-release link spectrum:
- quick-link — no LTO (the bench: frozen Bevy link corpus — compile once per platform, replay the link every iteration #55 profile): pure
objects → linker → executable. - thin-LTO —
lto = "thin". - full-LTO —
lto = "fat"/lto = true.
As with #55, producing the inputs (compilation) must not be part of the benchmark — build once per platform per mode, freeze the inputs and the captured final link command, and the benchmark times only the link invocation replayed per iteration.
Motivation
reld's story spans the fast dev link and (via the polylinker, #30) routing LTO links to a capable engine. Benchmarking all three modes on the same corpus (Bevy, #55) gives a single, comparable picture:
- quick-link isolates conventional linking speed (the dev-loop case reld optimizes).
- thin-LTO / full-LTO cover the heavier links where the linker's LTO plugin does whole-program work — the case reld routes to
lldtoday, and the one users hit for release-ish builds.
Three sections × the linker set (link.exe / lld-link / rust-lld / mold / reld, as available) = broad, apples-to-apples coverage.
Important scoping note (what is and isn't timed)
- Never time compilation. All object/bitcode inputs are produced once in a prep step and frozen. Iterations replay only the final link command.
- quick-link times pure linking:
objects → linker → executable. - thin-LTO / full-LTO inherently do LLVM whole-program optimization + codegen inside the link step (the linker's LTO plugin). That plugin work is part of the link invocation and is therefore legitimately in-scope for those two modes — the point of the LTO sections is to measure exactly that. The frozen inputs for these modes are the bitcode-bearing
.rlibs/objects; compilation up to bitcode is still prep, not measured.
This is the key difference from #55's quick-link profile, which deliberately sets lto = false to keep bitcode-WPO-codegen out of the measurement.
How to build each corpus mode
Per platform, build Bevy (same pinned version as #55) once in each mode and capture the exact final link with rustc --print link-args:
# quick-link (as in #55)
[profile.linkbench-quick]
inherits = "dev"
opt-level = 0
debug = 2
incremental = false
lto = false
codegen-units = 256
# thin-LTO
[profile.linkbench-thin]
inherits = "release"
lto = "thin"
debug = 2
incremental = false
# codegen-units left at the release default; thin-LTO manages its own partitioning
# full-LTO
[profile.linkbench-fat]
inherits = "release"
lto = "fat"
debug = 2
incremental = false
codegen-units = 1cargo build --profile <mode>
cargo rustc --profile <mode> -- --print link-args # capture per mode, per platform
Freeze the referenced inputs + normalized link command per (mode, platform), then replay per iteration with the linker swapped (hyperfine --prepare 'rm -f app' './link-<mode>-<linker>.sh').
Proposal
- Generalize the bench: frozen Bevy link corpus — compile once per platform, replay the link every iteration #55 corpus prep to build + capture three modes (quick / thin / fat) per platform, each frozen independently (keyed on Bevy version + platform + mode).
reld-benchgains a mode selector so it can replay any of the three frozen link commands N times per linker and report per-mode, per-linker medians as separate sections.- For LTO modes, ensure the frozen corpus includes the bitcode-bearing rlibs and the plugin flags from the captured command, so the LTO codegen happens at link time exactly as in a real build.
- Corpus refresh stays explicit (Bevy version bump); mold's LTO/
.rlibhandling scoped to Linux (per bench: frozen Bevy link corpus — compile once per platform, replay the link every iteration #55).
Open questions
- reld's LTO behavior. reld doesn't own LTO codegen; today LTO flags are rejected/ignored or (per the polylinker design Polylinker: flag-aware router over bundled linkers (LTO/optimized via routing + fallbacks) — design + docs #30) meant to route to
lld. The thin/fat sections should measure whatever reld does with an LTO link (route to lld, or error) and report it honestly — decide whether reld appears as a routed-to-lld series orn/auntil routing lands. - Determinism of LTO plugin timing — LTO codegen is heavier and slightly less stable run-to-run; may need more trials/warmups for the thin/fat sections.
- Storage size — three frozen corpora per platform multiplies the blob footprint (ties into bench: frozen Bevy link corpus — compile once per platform, replay the link every iteration #55's storage question and setup-soldr#463).
Acceptance criteria
- The benchmark reports three sections — quick-link, thin-LTO, full-LTO — over the same Bevy corpus, per platform, per linker.
- Inputs for all three modes are built once and frozen; no compilation happens inside the measured link loop (quick-link times pure linking; LTO modes time the link incl. its plugin codegen, with bitcode inputs pre-frozen).
- Per-mode final link commands are captured via
rustc --print link-argsand replayed unchanged against frozen inputs. - reld's LTO-link behavior is reported honestly (routed series or
n/a) rather than silently skipped. - RED -> GREEN: benchmark currently has only a non-LTO link path; after this it replays frozen thin-LTO and full-LTO links with zero in-loop compilation.
Cross-reference
- Builds on bench: frozen Bevy link corpus — compile once per platform, replay the link every iteration #55 (frozen Bevy link corpus — compile once, replay the link).
- Relates to the polylinker LTO routing design Polylinker: flag-aware router over bundled linkers (LTO/optimized via routing + fallbacks) — design + docs #30 (LTO → capable bundled engine) and the benchmark-stats surfacing work ci(bench): print per-OS performance stats in the job + verbose benchmark-stats branch publish #53.
Activity
zackees commentedon Aug 7, 2026
Tracked under meta #57 (frozen linker-object benchmark assets — storage/publishing/consumption + manifest.json).
feat(bench): frozen linker-object asset pipeline (manifest + replay) (#…
zackees commentedon Aug 24, 2026
Superseded by #70 and delivered in #71. The shipped benchmark covers exactly no-LTO, ThinLTO, and full-LTO over the same small cross-platform Rust workload, captures each real final link after out-of-loop compilation, verifies every output, and publishes strict no-N/A results with concrete engine metadata. The Bevy-specific corpus and permissive N/A direction in this proposal were intentionally replaced by the adopted design.