Skip to content

perf(build): Windows ship binaries strip the panic backtrace (build-std)#547

Merged
githubrobbi merged 2 commits into
mainfrom
perf/strip-release-binary
Jul 9, 2026
Merged

perf(build): Windows ship binaries strip the panic backtrace (build-std)#547
githubrobbi merged 2 commits into
mainfrom
perf/strip-release-binary

Conversation

@githubrobbi

Copy link
Copy Markdown
Collaborator

Shrinks the shipped Windows binaries by rebuilding std with panic="immediate-abort" in the release flow — a field panic becomes a bare, process-local abort() with no backtrace. The gimli/addr2line DWARF symbolization is ~10% of the CLI and is dead weight on a stripped binary; a panic is a should-never-happen bug anyway (the workspace lints forbid unwrap/panic in prod).

Commits

  • [profile.ship] (Cargo.toml): inherits release, panic = "immediate-abort", plus the cargo-features opt-in. Only ever built with -Z build-std; dev/normal-release/clippy are unaffected (verified).
  • release.yml: the Windows matrix row only builds --profile ship -Z build-std=std,panic_abort -Z build-std-features=optimize_for_size, then mirrors the .exes from ship/release/ so no packaging path changes. Linux/macOS stay on --release.

Measured

x86_64-pc-windows-msvc, uffs.exe: 1,292,800 → 1,167,872 (−9.7%) for build-std=std,panic_abort (validated locally). optimize_for_size is included but not separately measured — the release run confirms it.

Validation plan

Merge → just ship from clean main → watch the Windows leg of release.yml: it must build green, finish under the 75-min timeout, and the zip's uffs.exe should be ~1.17 MB. A build failure fails the whole release safely (nothing ships); the winget PR is a slow, cancellable downstream. Windows-only, so any revert leaves Linux/macOS untouched.

… backtrace

Field binaries are stripped, so a *symbolized* panic backtrace is dead weight:
the gimli/addr2line DWARF machinery inside std is ~10% of the CLI. Add a
dedicated `[profile.ship]` (inherits `release`, `panic = "immediate-abort"`),
built with `-Z build-std`, so a field panic is a bare, process-local `abort()`
(no message, no backtrace) — matching the workspace no-panic lint policy. Dev +
CI keep normal panics + full backtraces.

Measured (x86_64-pc-windows-msvc, uffs.exe): 1,292,800 -> 1,167,872 (-9.7%),
and it applies to every shipped binary. Deliberately NOT wired into the default
release — build-std is unstable + rebuilds std; opt in from the ship build when
ready. Normal dev/release/clippy builds are unaffected (used only with
`--profile ship -Z build-std`).
…std)

Wire the `ship` profile into the release build for the WINDOWS target only:
rebuild std with `panic=immediate-abort` + `optimize_for_size` via `-Z
build-std`, so shipped Windows binaries drop the field-useless backtrace
machinery (~10% off the CLI: uffs.exe 1,292,800 -> 1,167,872). Linux/macOS stay
on `--release`.

The `ship` profile outputs to target/<triple>/ship/; mirror the built .exe files
into release/ so the packaging steps need no path changes. Windows builds
natively on windows-latest with the pinned nightly + rust-src (both from
rust-toolchain.toml), so build-std resolves.

CAVEATS (validate with a pre-release tag before a real ship): build-std is
unstable (panic_immediate_abort changed shape across a recent nightly) and
rebuilds std, so watch the 75-min Windows timeout on a cold cache;
`optimize_for_size` was not measured locally (only `build-std=std,panic_abort`
was, at -9.7%) — a test release will confirm both.
@githubrobbi githubrobbi enabled auto-merge July 9, 2026 04:04
@githubrobbi githubrobbi added this pull request to the merge queue Jul 9, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 9, 2026
@githubrobbi githubrobbi added this pull request to the merge queue Jul 9, 2026
Merged via the queue into main with commit 833355b Jul 9, 2026
39 of 40 checks passed
@githubrobbi githubrobbi deleted the perf/strip-release-binary branch July 9, 2026 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant