Skip to content

perf(web): --wasm (skwasm) renderer + boot resource hints — ~40% smaller cold load (#2363) - #28

Merged
nickmeinhold merged 1 commit into
mainfrom
feat/wasm-and-resource-hints
Aug 11, 2026
Merged

perf(web): --wasm (skwasm) renderer + boot resource hints — ~40% smaller cold load (#2363)#28
nickmeinhold merged 1 commit into
mainfrom
feat/wasm-and-resource-hints

Conversation

@nickmeinhold

Copy link
Copy Markdown
Owner

Follow-up to #27 (modern boot + splash). Two cold-boot improvements.

1. --wasm (skwasm renderer)

Measured gzipped cold-load transfer:

path app code engine truly-cold total
CanvasKit (current) 715 KB js 2.9 MB canvaskit ~3.6 MB
--wasm (skwasm) 761 KB wasm 1.46 MB skwasm ~2.2 MB (~40% less)
  • Auth-safe: verified the --wasm build boots with no cross-origin-isolation headersflutter-view mounts, no SharedArrayBuffer/crossOriginIsolated error. skwasm falls back to single-threaded without COOP/COEP, so signInWithPopup (auth_service.dart:103) is untouched. (Corrects the old "wasm needs COI → breaks popup auth" assumption — no longer true on 3.44.)
  • No-break fallback: dart2wasm auto-ships a JS + CanvasKit fallback for browsers without WasmGC (Safari <18.2 etc).
  • Bonus: wasm starts faster than parsing equivalent JS.
  • Honest caveat: CanvasKit is older / more widely gstatic-cached than skwasm, so the realised win is smaller for someone who's used other Flutter apps — but real for first-timers, mobile, and the fresh-deploy path.

2. Resource hints

preconnect the hosts the app hits right after boot (www.gstatic.com engine+SDK; firestore/identitytoolkit/securetoken.googleapis.com for Firebase data+auth) so their TCP+TLS handshake overlaps the engine download during the splash instead of a cold handshake after.

⚠️ Gate before merge — visual render check

Headless has no WebGL, so I could confirm --wasm boots but not that the canvas renders identically. skwasm and CanvasKit are different Skia backends. This PR's preview-channel deploy is the gate: eyeball the canvas — custom painters, teal Person circles / terracotta Repo cards, grey contribution edges, shadows — against the CanvasKit version before merging.

🤖 Generated with Claude Code

Two cold-boot improvements on top of the modern-template work (#27):

1. --wasm: build with the skwasm renderer instead of CanvasKit. Measured
   gzipped cold-load transfer:
     CanvasKit  715KB app js  + 2.9MB  canvaskit  = ~3.6MB truly-cold
     skwasm     761KB app wasm + 1.46MB skwasm     = ~2.2MB truly-cold  (~40% less)
   Verified: builds clean (no code changes), boots with NO cross-origin
   isolation headers (flutter-view mounts, no SharedArrayBuffer/COI error) —
   skwasm falls back to single-threaded without COOP/COEP, so signInWithPopup
   (auth_service.dart:103) is NOT broken. dart2wasm auto-ships a JS+CanvasKit
   fallback for browsers without WasmGC (Safari <18.2 etc). Bonus: wasm starts
   faster than parsing equivalent JS.
   Caveat: CanvasKit is older/more widely gstatic-cached than skwasm, so the
   realised win is smaller for users who've hit other Flutter apps — but real
   for first-timers, mobile, and the fresh-deploy path.

2. Resource hints: preconnect the hosts the app contacts right after boot
   (www.gstatic.com for the engine+SDK; firestore/identitytoolkit/securetoken
   googleapis for Firebase data+auth) so their TCP+TLS handshake overlaps the
   engine download during the splash instead of paying a cold handshake after.

RENDERING NOT YET VISUALLY CONFIRMED under skwasm — headless has no WebGL. The
PR preview-channel deploy is the gate: eyeball the canvas (custom painters,
teal/terracotta nodes, contribution edges, shadows) renders identically to
CanvasKit before merge.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 2179f91):

https://domain-visualiser-app--pr28-feat-wasm-and-resour-hg211rwb.web.app

(expires Tue, 18 Aug 2026 06:17:39 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 0becdc05fe3c2187f0b584b6fed0b0a8209712f6

@nickmeinhold
nickmeinhold merged commit b372dc7 into main Aug 11, 2026
2 checks passed
@nickmeinhold
nickmeinhold deleted the feat/wasm-and-resource-hints branch August 11, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant