perf(web): size-focused wasm-release profile for the canvas build (36.2 → 23.2 MB) #134

Merged
funman300 merged 1 commits from perf/wasm-size-profile into master 2026-07-06 22:44:33 +00:00
Owner

canvas_bg.wasm ships at 36.2 MB. Adding a dedicated [profile.wasm-release] (opt-level s, fat LTO, codegen-units 1) for the solitaire_web build cuts it to 23.2 MB (−35.9%) after the unchanged wasm-opt -O2 pass.

  • The binaryen pass stays at -O2 — the historical -Oz grey-screen miscompile note still applies; this change is rustc-side only.
  • strip is deliberately NOT set in the profile: on wasm it removes the target_features custom 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

  • All 5 play_canvas.spec.js e2e tests pass against the new artifact (bridge, draw3, apply/undo, replay diagnostics, 40-seed autoplay invariants).
  • Local headless pixel check is inconclusive: wgpu can't create a usable adapter in this environment and panics identically on the current production artifact, so it's environmental. Post-deploy, production /play should be visually compared against its current known-good render (336 distinct colours in a headless CLI screenshot).
  • cargo clippy --workspace -- -D warnings clean; profile-only change, no code touched.

🤖 Generated with Claude Code

`canvas_bg.wasm` ships at **36.2 MB**. Adding a dedicated `[profile.wasm-release]` (opt-level `s`, fat LTO, codegen-units 1) for the `solitaire_web` build cuts it to **23.2 MB (−35.9%)** after the unchanged `wasm-opt -O2` pass. - The binaryen pass stays at `-O2` — the historical `-Oz` grey-screen miscompile note still applies; this change is rustc-side only. - `strip` is deliberately NOT set in the profile: on wasm it removes the `target_features` custom 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 - All 5 `play_canvas.spec.js` e2e tests pass against the new artifact (bridge, draw3, apply/undo, replay diagnostics, 40-seed autoplay invariants). - Local headless pixel check is inconclusive: wgpu can't create a usable adapter in this environment and panics **identically on the current production artifact**, so it's environmental. Post-deploy, production `/play` should be visually compared against its current known-good render (336 distinct colours in a headless CLI screenshot). - `cargo clippy --workspace -- -D warnings` clean; profile-only change, no code touched. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
funman300 added 1 commit 2026-07-06 22:44:32 +00:00
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>
funman300 merged commit 15bb136c79 into master 2026-07-06 22:44:33 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/Ferrous-Solitaire#134