8000 biome: thin LTO under the detbuild shim instead of fat LTO by bryan-minimal · Pull Request #1740 · gominimal/pkgs · GitHub
[go: up one dir, main page]

Skip to content

biome: thin LTO under the detbuild shim instead of fat LTO - #1740

Merged
bryan-minimal merged 1 commit into
mainfrom
biome-build-speed
Nov 27, 2026
Merged

bryan-minimal merged 1 commit into
mainfrom
biome-build-speed

Conversation

@bryan-minimal
@bryan-minimal bryan-minimal commented Nov 26, 2026 •
Copy link
Copy Markdown
Member

What

Upstream biome's .cargo/config.toml sets [profile.release] lto = true (fat LTO). Fat LTO runs the final optimisation of the whole crate graph on one core. This PR:

The CVE-2026-111943 lock patch and its checks, BIOME_VERSION, and --remap-path-prefix are unchanged.

Why

biome takes about 32 min (one arch) and 25 min (the other) on the build-bot. Most of that is the serial fat-LTO link.

Build time

before (main) this PR
build-bot arm64 wall / CPU 1136–1291 s / ~2400 s 185 s / 2657 s
build-bot amd64 wall / CPU 1151–1856 s / 2550–3490 s 204 s / 4246 s
build-bot artifact bytes ~58–60 MB 76 MB
local min box (6 CPU), two runs - 342 s, 327 s

Build-bot numbers come from res-server's wall_s / cpu_lower_bound_s journal fields. The baseline is main's builds from the last 2 days; this PR's are from run e4e1ce24.

Reproducibility evidence

I ran two clean local --rebuilds, each in a freshly activated session (arm64):

  • run 1: d55f45796bc0daa22c2c2e3a2dfe0bf5a837f43353606679bd3b4ea28ce5b66a, 193,544,520 B
  • run 2: d55f45796bc0daa22c2c2e3a2dfe0bf5a837f43353606679bd3b4ea28ce5b66a, 193,544,520 B

The two binaries are byte-identical.

The artifact is about 30% larger, which is the usual cost of thin LTO compared with fat LTO.

Runtime trade-off

Fat LTO usually gives a binary a few percent faster than thin LTO. For a linter/formatter CLI, that is worth less than a build several times faster, so this PR accepts it, as #1713 did for codex.

🤖 Generated with Claude Code

Upstream's .cargo/config.toml sets [profile.release] lto = true, which runs the
whole crate graph's final optimisation on one core (~32/25 min on the
build-bot). Override it to thin LTO, add v0 mangling, fetch crates first, and
run the now-offline build under packages/detbuild, the codex recipe (#1713).
build.sh echoes the binary's sha256 so two builds can be compared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai
coderabbitai Bot commented Nov 26, 2026 •
Copy link
Copy Markdown
Contributor

Warning

Review limit reached

  • Run on-demand review

This review includes 2 billable files and costs up to $0.50.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 48 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available. Your 59 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between f44b00d and 0540f31.

Files selected for processing: 2

  • packages/biome/build.ncl
  • packages/biome/build.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@bryan-minimal
Copy link
Copy Markdown
Member Author

Build-bot minimal build green (run e4e1ce24): wall arm64 185 s (was 1136–1291 s), amd64 204 s (was 1151–1856 s). Local double build sha256 d55f4579…5b66a both runs (193,544,520 B), byte-identical.

@bryan-minimal
bryan-minimal marked this pull request as ready for review November 26, 2026 22:07
@bryan-minimal
bryan-minimal requested a review from a team as a code owner November 26, 2026 22:07
@norrietaylor norrietaylor left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scope matches the title. The two files change only the LTO mode, the mangling flag, the fetch and build split, and one log line. The CVE-2026-111943 lock patch, its checks and BIOME_VERSION are unchanged.

Clobber none. git log -- packages/biome shows only version bumps before this commit, and the diff reverts none of them.

Correctness the preload follows the Preloading detbuild rules in AGENTS.md. detbuild is in build_deps. The preload is a one-command prefix. The preloaded cargo has --frozen, and cargo fetch --locked runs first without the preload. The shape is the same as packages/codex/build.sh:98-106. One finding: the claim that no build script downloads is a manual check for 2.6.9, and nothing checks it again on a version bump.

Not checked. I did not read the upstream source, because the sandbox denied the network fetch. So these claims are not verified: upstream sets lto = true in .cargo/config.toml, upstream leaves codegen-units at the default, and no build script that biome_cli reaches downloads. I did not run detbuild_preload_guard.py, because it needs a catalog dump. The reproducibility evidence in the PR body is for arm64 only. An amd64 double build needs a build, and I did not do it. The agent.version field is unknown because the sandbox denied claude --version.

Comment thread packages/biome/build.sh
# All network access happens here, with real entropy: crates are fetched (and
# checked against Cargo.lock) before the shim below is loaded, so no TLS session
# runs with the shim's fixed bytes. No build script biome_cli reaches downloads
# anything (checked for 2.6.9), so the build below needs no network.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low · The comment says no build script downloads, and that someone checked it for 2.6.9. Nothing in the script checks it again. Biome version bumps are routine commits (Update biome to 2.6.9 (#1699) and five before it), and a bump does not repeat a manual check. --frozen stops cargo fetches only. A build.rs that downloads in a later release will make its TLS session with the shim's fixed bytes, and the build will still pass. packages/codex/build.sh:80-83 fails closed on its one known downloader (v8). Add a check that fails the build, for example a grep of Cargo.lock for known downloader crates, or remove the version-specific claim and state what a bump must check. This is the only package of the six shim users that states a per-version manual check.

@bryan-minimal
bryan-minimal added this pull request to the merge queue Nov 27, 2026
Merged via the queue into main with commit 1897303 Nov 27, 2026
16 checks passed
@bryan-minimal
bryan-minimal deleted the biome-build-speed branch November 27, 2026 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment 666F

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0