Skip to content

Reduce release build time and binary size - #1449

Open
John-David Dalton (jdalton) wants to merge 1 commit into
mainfrom
agent/release-codegen-units
Open

John-David Dalton (jdalton) wants to merge 1 commit into
mainfrom
agent/release-codegen-units

Conversation

@jdalton

@jdalton John-David Dalton (jdalton) commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

LLM Description written by Codex: GPT-6

User impact

Release builds can complete faster and produce a smaller CLI binary. The repeated hosted measurement on Rust 1.93.1 reported median build times of 350.780s with the default settings and 333.036s with one codegen unit, a 5.06% ratio-of-medians reduction. The measured binary was 16.27% smaller.

Change

Set [profile.release] to one codegen unit. Set ci-release, perf, and addon explicitly to 16 to preserve their current inherited configuration.

Evidence and limits

The repeated hosted run is here. It used Ubuntu 24.04 x86_64 and Rust 1.93.1. Its source revision predates the current main source tree; current main has changed Rust code since the measurement, so exact build-time and size results may differ. This measurement does not claim runtime improvement or results for other release platforms.

Exact-head validation

On macOS 27 arm64 with Rust 1.93.1 and clean, separate targets, the candidate release build completed in 210.836s versus 220.474s for the same commit with a codegen-units=16 override. Compiler invocations confirmed codegen-units 1 and 16 respectively. This is one pair (4.37% faster in that pair), not repeated performance evidence. Binary sizes were 18,978,624 versus 22,864,448 bytes (17.0% smaller). --version and --help output matched. The release-mode golden tests passed: 1 redirect fixture test and 2 SBT golden tests.

CI

The CI run 38307581268 has ci-ok failing because one Cargo fixture test could not connect to static.crates.io to download cfg-if; 38 tests in that job passed and one failed on the download. The failure log is here. The change does not modify Cargo.lock or dependency configuration.


Note

Low Risk
Build-profile-only change with no runtime logic; main risk is longer release compile times or different optimization on non-overridden profiles if inheritance is misconfigured.

Overview
Tunes Rust release builds by setting codegen-units = 1 on [profile.release], aiming for a smaller shipped CLI and modestly faster release links (per hosted benchmarks in the PR description).

Because ci-release, perf, and addon inherit release, the PR pins codegen-units = 16 on those profiles so CI test shards, perf/bench builds, and the Node addon keep faster parallel codegen and do not pick up the single-unit release setting.

Reviewed by Cursor Bugbot for commit a51923e. Configure here.


Generated by Claude Code

Use one codegen unit for release builds based on repeated hosted build measurements. Preserve the existing effective setting for inherited profiles.

Assisted-by: Codex: GPT-6
@mikolalysenko

Copy link
Copy Markdown
Collaborator

Final reviewer: I turned auto-merge off on a51923e. ci-ok is red because the cargo 1.93.1 lock-v4 (ubuntu-latest) job failed (job log). The PR also has no approval and no Ready for review label. Auto-merge will be turned back on once CI is green and the PR qualifies.


Generated by Claude Code

@mikolalysenko Mikola Lysenko (mikolalysenko) added the Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review label Oct 12, 2026
@mikolalysenko

Copy link
Copy Markdown
Collaborator

Ready for review (burn-down agent)

  • Head: a51923e414f05789da6c7570c7169656368b06ea
  • CI: 35/35 green, 19 path-skipped. The cargo 1.93.1 lock-v4 (ubuntu-latest) failure the final reviewer flagged passed on re-run (run 38307581268, attempt 2).
  • Bugbot: reviewed this head, no findings.
  • Reviewer: one-line Cargo.toml profile change. Shipped release builds use codegen-units = 1, and the ci-release/perf/addon profiles stay at 16 so CI link times don't grow. The timing evidence in the description is a single pair of runs.
  • Slack announcement not sent: the Slack connector in this session has no send tool.

Generated by Claude Code

@mikolalysenko

Copy link
Copy Markdown
Collaborator

Final review brief

What it does: Sets codegen-units = 1 on [profile.release], the profile that builds the shipped CLI binaries. The three profiles that inherit from release (ci-release, perf, addon) get an explicit codegen-units = 16, so CI test shards, benchmarks and the Node addon build exactly as before. The PR measured a ~16-17% smaller binary and a ~4-5% faster release build.

Risk: low. One file, four added lines, build config only. The only thing that changes is how the shipped binary is compiled (release.yml cargo build --release / cross build --release); the code is the same. One codegen unit with full LTO is a common, well-tested rustc setup.

Look here:

Verified: read the full diff. Checked that no other profile inherits release and that no workflow or .cargo config overrides CARGO_PROFILE_*_CODEGEN_UNITS. Checked that only release.yml builds with --release, and its build job has no tight timeout. Checked that CHANGELOG.md is untouched. CI: ci-ok and clippy green on a51923e; the earlier cargo 1.93.1 lock-v4 failure was a static.crates.io download error and passed on re-run. Bugbot: reviewed this head, no findings.

Changes I made: none.

Open questions: none blocking. The PR description's "CI" section still says ci-ok is failing; that is out of date (it went green on re-run). Release-build timing was measured on Linux x86_64 and macOS arm64 only; Windows and cross targets weren't measured, but nothing suggests they would regress meaningfully.

Auto-merge (squash) is armed, so approving sends this straight to the merge queue.


Generated by Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ready for review Agent-verified: mergeable, CI green, Bugbot clean — awaiting human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants