Skip to content

perf(website): add rel=preload for gosqlx.wasm on /playground #402

@ajitpratap0

Description

@ajitpratap0

Problem

The 6.5 MB WASM binary starts downloading only after JS hydration on the /playground page, delaying interactive time significantly. The load waterfall is:

  1. Page hydrates → JS evaluates → initWasm() called
  2. loadScript("/wasm/wasm_exec.js") fetched (sequential)
  3. fetch("/wasm/gosqlx.wasm") — 6.2 MB (sequential, no preload)
  4. WebAssembly.instantiate() called

This makes the playground unusable for several seconds on first load, especially on mobile.

Fix

Add to the playground page: <link rel='preload' as='fetch' href='/wasm/gosqlx.wasm' crossOrigin='anonymous'> — this starts the WASM download in parallel with JS execution, cutting time-to-interactive by 1–3 seconds on fast connections and 5–15 seconds on mobile.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions