perf(contracts): document and benchmark size-optimized release profile#378
Open
noevidence1017 wants to merge 1 commit into
Open
perf(contracts): document and benchmark size-optimized release profile#378noevidence1017 wants to merge 1 commit into
noevidence1017 wants to merge 1 commit into
Conversation
Adds a reproducible WASM size benchmark and records the before/after impact of the size-tuned [profile.release] (LTO, codegen-units=1, opt-level="z", panic="abort", symbol stripping) that ships in contracts/Cargo.toml. - scripts/bench-wasm-size.sh builds each contract for wasm32-unknown-unknown with the optimized profile and again with a naive release baseline (via cargo --config overrides, mutating nothing on disk) and prints the per-artifact size delta. - docs/wasm-size-optimization.md explains each profile knob (including why strip="symbols" is preferred over "debuginfo" and why overflow-checks stays on) and records the measured result. - contracts/Cargo.toml gains inline rationale for every profile setting. Measured (invisible_wallet, wasm32-unknown-unknown, toolchain 1.85.0): naive release 626,198 B -> optimized 30,319 B = 95.2% smaller. Tests still pass: cargo test -p invisible-wallet -> 49 passed; 0 failed. Closes Miracle656#364
|
@noevidence1017 is attempting to deploy a commit to the miracle656's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@noevidence1017 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
Summary
Resolves the LTO / size-tier optimization work for the Soroban contracts and, per the acceptance criteria, records the before/after sizes and a reproducible benchmark.
The size-tuned
[profile.release](lto = true,codegen-units = 1,opt-level = "z",panic = "abort", symbol stripping) already exists incontracts/Cargo.toml. Because Cargo only applies[profile.*]from the workspace root, that is the correct location for it (member-crate profiles are ignored). This PR makes the optimization measurable and documented rather than implicit.Changes
scripts/bench-wasm-size.sh— builds each contract forwasm32-unknown-unknowntwice: once with the optimized profile and once with a naive release baseline (opt-level = 3,lto = false,codegen-units = 16,strip = "none"), applied purely throughcargo --configoverrides so nothing on disk is mutated. Prints a per-artifact size delta.docs/wasm-size-optimization.md— explains each profile knob (including whystrip = "symbols"is used instead of"debuginfo"— it is a strict superset — and whyoverflow-checksstays on for on-chain safety) and records the measured result.contracts/Cargo.toml— inline rationale comments for every profile setting; values unchanged.Before / after
invisible_wallet,wasm32-unknown-unknown, toolchain 1.85.0:releaseReproduce with
scripts/bench-wasm-size.sh -p invisible-wallet. The saving (LTO dead-code elimination + symbol stripping + the"z"tier) is well beyond the ~30% target.Tests
cargo test -p invisible-wallet→ 49 passed; 0 failed.Closes #364