perf(web): size-focused wasm-release profile for the canvas build (36.2 → 23.2 MB) #134
Reference in New Issue
Block a user
Delete Branch "perf/wasm-size-profile"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
canvas_bg.wasmships at 36.2 MB. Adding a dedicated[profile.wasm-release](opt-levels, fat LTO, codegen-units 1) for thesolitaire_webbuild cuts it to 23.2 MB (−35.9%) after the unchangedwasm-opt -O2pass.-O2— the historical-Ozgrey-screen miscompile note still applies; this change is rustc-side only.stripis deliberately NOT set in the profile: on wasm it removes thetarget_featurescustom section and wasm-opt then rejects the module.pkg/is not committed here — web-wasm-rebuild is the single source of truth and regenerates it on merge.Verification
play_canvas.spec.jse2e tests pass against the new artifact (bridge, draw3, apply/undo, replay diagnostics, 40-seed autoplay invariants)./playshould be visually compared against its current known-good render (336 distinct colours in a headless CLI screenshot).cargo clippy --workspace -- -D warningsclean; profile-only change, no code touched.🤖 Generated with Claude Code
canvas_bg.wasm shipped at 36.2 MB — plain release (opt-level 3, thin LTO) piped through wasm-opt -O2. Download size, not throughput, is the binding constraint for the browser canvas, so solitaire_web now builds with a dedicated wasm-release profile: opt-level "s", fat LTO, one codegen unit. Local result: 23.2 MB after the unchanged wasm-opt -O2 pass — 35.9% smaller. The binaryen pass stays at -O2 (the -Oz grey-screen miscompile note in build_wasm.sh still applies). profile.strip is deliberately NOT set: on wasm it also removes the target_features custom section, which makes wasm-opt reject the module ('all used features should be allowed' on trunc_sat). Verified with the new artifact: all 5 play_canvas e2e specs pass (debug bridge, draw3 param, apply/undo, replay diagnostics, 40-seed autoplay invariants). Headless pixel verification is inconclusive in this environment — wgpu cannot create a usable adapter locally and panics identically on the OLD artifact too — so visual parity should be confirmed against production after the next deploy. pkg/ artifacts are intentionally not committed: the web-wasm-rebuild workflow is the single source of truth and will regenerate them with this profile on merge. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>