Skip to content

Performance and bundle size

Budgets are enforced by pnpm bench and pnpm size (.size-limit.json). Numbers below were measured on 2026-11-27 on the development machine (Apple M3 Max, Chrome 159) — not a mid-range laptop. Re-measure on a mid-range machine before treating the 60 fps target as met (see open questions in the 1a gate report).

Entities moving (Transform + Velocity) ms per fixed step
1,000 0.06
5,000 0.28 (budget 4.0)
20,000 1.18

Rendering (/?bench=sprites&n=2000, Chrome, WebGL)

Section titled “Rendering (/?bench=sprites&n=2000, Chrome, WebGL)”

2,000 textured, moving sprites: ~1.6 ms CPU per frame (simulation + PixiJS submit), i.e. ~10× headroom inside a 16.7 ms frame. GPU time is not included; measure FPS on a mid-range laptop with the on-screen counter.

The 1a demo scene: ~0.6 ms simulation, ~2–3 ms per frame including the debug overlay.

Sprout (level 1, dev build): ~0.25 ms per fixed step including rendering (measured by stepping the game 600 times from the console), 48 render nodes.

Entry Size Budget
core (everything) 5.5 kB 15 kB
core (typical import) 4.7 kB 12 kB
physics-arcade 3.0 kB 10 kB
input 2.3 kB 5 kB
audio (incl. synthesizer) 2.5 kB 5 kB
camera 1.0 kB 3 kB
world 1.2 kB 4 kB
render-2d (without PixiJS) 6.7 kB 10 kB
demo-1a, all chunks incl. PixiJS 187 kB 250 kB
sprout, all chunks incl. PixiJS, game logic kit and all level data 192 kB 220 kB

Game totals count every chunk, including PixiJS’s WebGPU and Canvas renderers, which load lazily and only when selected (the game prefers WebGL), so the real first download is smaller.

Since 1b, production bundles contain no Zod: documents are validated and normalized at build time (ADR 0016), which took the 1a demo from 207 kB to 187 kB. pnpm size fails if Zod reappears in a game bundle. Sprout’s images total about 8 kB and its audio data about 9 kB; both are fetched as assets, not bundled.

Platform load test (load/platform.js, k6; ADR 0028)

Section titled “Platform load test (load/platform.js, k6; ADR 0028)”

Sized from the 10,000-monthly-player profile in docs/hosting.md: about 1 request/s on average, assumed ~10 req/s at peak. The peak profile runs about 5× that peak for 5 minutes:

  • 40 players browsing (catalog, game page, the game’s files);
  • 10 saves a second;
  • 20 players in 2-player rooms sending inputs 10 times a second.

Local baseline, 2026-11-29. This is the platform in local mode (production build, PGlite in-process, one Node process) on the development machine (Apple M3 Max), with k6 in Docker on the same machine. It is not the VPS. Re-run it against the VPS (with Postgres) before launch, with the owner’s OK.

Measure Result Threshold
Requests 17,814 in 4.6 min (~65 req/s), 0 failed < 1% failed
Pages, p95 13 ms 800 ms
API, p95 12 ms 400 ms
Game files (play origin), p95 7 ms 400 ms
Rooms 159 sessions, ~845 frames/s received; 1 ticket refused (the per-account limit of 60 rooms an hour) and 15 sessions whose pair fell out of step after it —

Run it: pnpm tsx scripts/load-seed.ts against a local platform, then GAME=... TOKEN=... scripts/load-test.sh (PROFILE=smoke for a 20-second check).