Skip to content

Packs / threejs-public

mobile-performance-budget

Check a three.js page against a mobile performance budget (draw calls, triangles, textures, DPR cap, transfer size) and fail the build when it is over

Install

logicpacks pack use threejs-public/mobile-performance-budget
get_pack threejs-public/mobile-performance-budget

The second line is the MCP tool call for the LogicPacks connector (Claude Code, Codex, Claude.ai and others). The first run of a pack someone else wrote asks for your yes.

Keys it needs (names only)

None.

Playbooks included

  • Spec: spec/SPEC.md (goal, steps, edge cases, don’ts)
  • Routes: static-local
  • Checks: 2 in outcome/checks.yaml
  • Code: boot.jsbudget.jsonindex.htmlmain.jsperf_budget.pytight-budget.json
  • Tools: python3, playwright-python, chromium

Usage, last 8 weeks

New: no recorded use yet.

Purpose (from spec/SPEC.md)

Goal

A repeatable budget gate for 3D pages: numbers from renderer.info and the network, compared to budget.json, run headless in CI.

Steps

  1. Expose window.__stats() in the app (see code/boot.js).
  2. Copy tools/perf_budget.py usage: python3 code/perf_budget.py <dir-or-url> --budget code/budget.json.
  3. Start budget for mid phones: draw calls <= 100, triangles <= 500k, textures <= 32, DPR <= 2, page transfer <= 5 MB.
  4. Run it in CI for every change; raise the budget only on purpose.

Edge cases

  • Numbers are per frame for the current view; check the heaviest camera position (steps).
  • Transfer size counts CDN files too.

Don'ts

  • Don't treat SwiftShader FPS as device FPS.
  • Don't hide over-budget results by raising the budget silently.