Skip to content

Reduce release build time and binary size - #1449

Merged
Mikola Lysenko (mikolalysenko) merged 1 commit into
mainfrom
agent/release-codegen-units
Oct 13, 2026
Merged

Mikola Lysenko (mikolalysenko) merged 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

Merged via the queue into main with commit 501c6d9 Oct 13, 2026
100 of 102 checks passed
@mikolalysenko
Mikola Lysenko (mikolalysenko) deleted the agent/release-codegen-units branch October 13, 2026 13:43
github-merge-queue Bot pushed a commit that referenced this pull request Oct 13, 2026
* ci(release): publish npm from release.yml, not publish-npm.yml

Every socket-patch npm package's trusted publisher is registered against
release.yml, and npm allows only one publisher per package. The 5.0.0
release dispatched publish-npm.yml, whose OIDC token named that file, so
npm rejected it with E401 before staging anything.

Move the npm leg back inline as release.yml's npm-publish job (same steps
as publish-npm.yml) and delete publish-npm.yml, so the existing
registration keeps working. Add an `npm-retry-version` input that skips
the version gate, build, tag, GitHub release and crates.io jobs and
re-stages npm from an existing release's assets; this retries 5.0.0 now
and replaces the manual Publish npm dispatch. crates.io stays dispatched
through publish-cargo.yml, since crates.io allows several publishers per
crate.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* chore(release): fold 22 more PRs into the 5.0.0 notes

Cover the PRs merged to main after #1432's base (1779317..4cb3643):
Cargo source replacement and registry = "crates-io" (#338/#455, #386),
pnpm lockfile=false (#1074), berry removed descriptors (#1435), yarnrc
${VAR} reads (#1100), CRLF .npmrc append (#1196), Composer vendor-dir
cascade and global home (#439/#686, #586), Go +incompatible vex (#484),
gem moved BUNDLE_GEMFILE and commented Gemfile revert (#952, #988),
Poetry source = "pypi" (#1282) and Hatch path characters (#547).

No entries for #1411 (macOS fix to code #1393 added in this release;
the #1393 entry already describes the intended behavior), #1426 (perf
regression introduced and fixed within 5.0.0) or the CI/test/bench PRs.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* chore(release): cover #1419, #1434, #1440, #1442, #1444 in the 5.0.0 notes

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* chore(release): 5.0.1

Cut [Unreleased] into [5.0.1] — 2026-10-13 and stamp 5.0.1 with
scripts/version-sync.sh. The 5.0.1 notes cover main through 501c6d9
(#1449), i.e. every PR after the v5.0.0 tag (6ad6add): the npm
publish fix (5.0.0 never reached npm or crates.io, 5.0.1 is the first
v5 there), #1465, #759, #1460, #1462, #1445, #869, #1447, #1450,
#1467, and #1449 under Maintenance. CI/test-only PRs (#1448, #1452,
#1454, #1457, #1459) have no entries.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* chore(release): 5.0.1 notes for PRs merged since the cut

Covers #1469, #1470, #1474, #1475, #1478, #1479, #1480 and #1482; #1484 is
CI-only. The notes now cover main through 285a5e8.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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