perf(build): Windows ship binaries strip the panic backtrace (build-std)#547
Merged
Conversation
… 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Shrinks the shipped Windows binaries by rebuilding std with
panic="immediate-abort"in the release flow — a field panic becomes a bare, process-localabort()with no backtrace. Thegimli/addr2lineDWARF 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): inheritsrelease,panic = "immediate-abort", plus thecargo-featuresopt-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 fromship/→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%) forbuild-std=std,panic_abort(validated locally).optimize_for_sizeis included but not separately measured — the release run confirms it.Validation plan
Merge →
just shipfrom clean main → watch the Windows leg ofrelease.yml: it must build green, finish under the 75-min timeout, and the zip'suffs.exeshould 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.