build(antd): size-optimized release profile (strip + thin LTO)#195
build(antd): size-optimized release profile (strip + thin LTO)#195Nic-dorman wants to merge 1 commit into
Conversation
Adds [profile.release] with strip = symbols, lto = thin, codegen-units = 1. Measured 2026-06-09 against the default release profile: Linux 36.5 MB -> 22.1 MB (-37%), Windows .exe 29.8 MB -> 24.6 MB (-17%). strip is the dominant, zero-cost win on Linux; thin LTO + single codegen unit add the rest. Cost is a slower release link only (dev builds unaffected). Both optimized binaries smoke-tested on Linux + Windows: launch, --help, and serve a valid /health response. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
macOS arm64 measurement (2026-06-10)Built locally on Apple Silicon (M-series) to fill in the gap left by the Linux/Windows numbers in the PR body:
For reference alongside the existing table:
macOS lands between Linux and Windows — closer to Linux, as expected since Mach-O carries embedded debug symbols that Build-time cost on mac: 1m 53s → 2m 30s (+37s, +33%). Much smaller than the Linux 1m → 4.5m jump noted in the PR — Apple Silicon handles the thin-LTO link cheaply. Caveat: the comparison was No CI change needed to capture this — |
@
What
Adds a size-tuned
[profile.release]toantd/Cargo.toml:Why
The release binary used cargos default release profile (unstripped,
codegen-units = 16, no LTO). antd is a single static binary embedding a full P2P client (ant-core/saorsa + QUIC), the EVM payment stack (alloy/evmlib), and both a REST (axum) and gRPC (tonic) server — so there was real, untapped size headroom.Measured impact (2026-06-09)
Built the same binary with the default profile vs. this profile:
antd-linux-amd64)antd-windows-amd64.exe)stripis the dominant, zero-cost win on Linux (debug symbols the Windows.exenever carried — they live in a separate.pdb). Thin LTO + a single codegen unit add the rest and tend to improve runtime perf. Stripped+LTOd, both platforms converge to ~22–24 MB.Cost: a slower release link (Linux ~1→4.5 min, Windows ~3→7 min). This is
profile.releaseonly — dev/cargo buildinner-loop times are unaffected.Verification
Both optimized binaries were smoke-tested on Linux and Windows: they launch, print
--help, and serve a valid/healthresponse ({"status":"ok",...}) while running. No behavior change beyond the binary layout.🤖 Generated with Claude Code
@