Files
FFF_vtt_frozen/prototype-pixi-perf

Pixi v8 VTT perf prototype (THROWAWAY)

Question: can PixiJS v8 (8.22) render a VTT-sized scene smoothly on modest hardware? Measurement tool, not the product.

Run

All commands through devbox (NixOS, nothing global):

devbox run -- npm install
devbox run -- npm run dev            # http://localhost:5173
devbox run -- npm run dev -- --host  # reachable from LAN
devbox run -- npm run build          # tsc + vite build

URL params (joined with &, e.g. ?renderer=webgpu&res=1&bench=1): ?renderer=webgl|webgpu (prefer, not force: Pixi falls back to WebGL silently if WebGPU is unavailable, so check the overlay / benchmark header for requested X → fallback), ?res=1 (canvas resolution, default min(dpr,2)), ?bench=1 (auto-run benchmark on load), ?benchMs=5000&warmMs=700. Use the dev server (port 5173), not the stale 4173 preview build.

WebGPU on Linux Chrome (what actually worked): set these at chrome://flags, then relaunch Chrome: #enable-vulkan, #enable-unsafe-webgpu, #ignore-gpu-blocklist. CLI flags (--enable-unsafe-webgpu --enable-features=Vulkan) were overridden by the NixOS wrapper / an already-running Chrome process. Confirm WebGPU is enabled at chrome://gpu.

Controls (top right): map size, tile size override (auto = GPU max texture), local map image, grid on/off + cell size, token count, chaos, HP churn, culling, tool (move / pen), +200 random strokes, Run benchmark (markdown table in the textarea; copy button). Mouse: wheel = zoom, drag = pan / drag a token, pen tool: LMB draws, RMB/MMB pans. Touch: 1 finger = drag token / pan / draw, 2 fingers = pinch zoom + pan.

Test on mobile

devbox run -- npm run dev -- --host, open http://<LAN-IP>:5173 on the phone/tablet (same network; open the firewall for 5173 on NixOS if needed: networking.firewall.allowedTCPPorts). Then use the on-screen overlay and the benchmark button. Done: Galaxy Note 10 (SM-N970F), WebGL, Chrome 156 Android. See benchmark (D) below. Not done: other phones, tablets, iOS.

Headless benchmark (software GL, NOT representative)

bench.mjs drives chromium (from devbox) via playwright-core with SwiftShader (software GL). Only useful as a harness smoke test; real numbers come from the in-page button on real hardware (see Benchmark below).

devbox run -- npm run build && devbox run -- npx vite preview --port 4173 &
devbox run -- bash -c 'CHROMIUM=$(which chromium) node bench.mjs http://localhost:4173/'

Benchmark

Scenario for all runs = view fitted to whole map (so small maps show all tokens on screen, large maps show only a fraction), chaos on, grid on, cull on, 5 s each after 700 ms warmup. fps is capped at 60 (vsync / rAF), so fps is not a headroom metric on real GPUs: use js ms (JS time per frame measured after Pixi's render call) as headroom. Frame budget is 16.7 ms.

Software GL (headless Chromium 155, SwiftShader, 1280x720, res 1, WebGL2, maxTex 8192) — NOT REPRESENTATIVE

CAVEAT: CPU-emulated GPU. Absolute numbers and the shape are artifacts of SwiftShader. Kept only as the first harness run; superseded by the real-hardware runs (A)-(D) below. With software GL the driver blocks inside draw calls, so js ms is inflated at high token counts.

map map path tokens strokes fps avg ms p99 ms worst ms js ms frames
2048 single 50 0 59.8 16.7 29.9 30.3 0.9 299
2048 single 200 0 48.4 20.6 41.2 43.1 1.7 242
2048 single 500 0 31.0 32.3 36.3 38.0 4.2 154
2048 single 1000 0 20.1 49.9 54.6 54.6 7.8 100
2048 single 2000 0 11.5 86.9 94.2 94.2 85.7 59
4096 single 50 0 60.0 16.7 27.1 33.6 0.7 300
4096 single 200 0 56.5 17.7 33.3 34.5 1.7 282
4096 single 500 0 43.2 23.2 49.3 51.3 3.9 216
4096 single 1000 0 30.1 33.2 38.0 39.2 7.0 150
4096 single 2000 0 18.8 53.2 58.5 58.5 52.3 96
8192 single 50 0 60.1 16.6 26.1 29.3 0.7 300
8192 single 200 0 58.4 17.1 32.9 40.8 1.7 291
8192 single 500 0 48.0 20.8 40.2 41.0 3.9 240
8192 single 1000 0 36.4 27.5 33.2 39.8 7.3 182
8192 single 2000 0 23.4 42.8 48.5 49.1 42.2 118
16384 4 tiles 50 0 59.7 16.8 28.0 33.0 0.7 298
16384 4 tiles 200 0 58.1 17.2 32.2 34.2 2.2 290
16384 4 tiles 500 0 48.1 20.8 38.3 40.6 4.8 240
16384 4 tiles 1000 0 37.8 26.5 44.9 52.2 8.2 189
16384 4 tiles 2000 0 25.4 39.3 45.4 46.0 38.7 129
4096 single 50 200 38.2 26.1 49.1 49.7 0.7 191
4096 single 500 200 28.2 35.4 45.5 111.9 4.7 141

(A) Laptop, WebGL run 1 — Linux Chrome 155, AMD Radeon 780M

Renderer: webgl, GPU: ANGLE (AMD, AMD Radeon 780M Graphics (radeonsi phoenix ACO), OpenGL 4.6), maxTex 16384, res 1.203125, viewport 1877x1058, 5000ms/scenario (+700ms warmup), chaos on, grid on, cull on UA: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36

map map path tokens strokes fps avg ms p99 ms worst ms js ms frames
2048 single 50 0 60.0 16.7 18.3 19.1 0.4 300
2048 single 200 0 60.0 16.7 18.3 18.4 1.5 299
2048 single 500 0 60.0 16.7 18.1 18.3 2.9 300
2048 single 1000 0 60.0 16.7 18.0 18.1 5.3 300
2048 single 2000 0 60.0 16.7 17.9 18.4 9.7 300
4096 single 50 0 60.0 16.7 18.9 19.4 0.4 300
4096 single 200 0 60.0 16.7 18.3 19.5 1.6 300
4096 single 500 0 60.0 16.7 18.6 19.6 3.1 300
4096 single 1000 0 60.0 16.7 18.3 19.3 5.3 300
4096 single 2000 0 60.0 16.7 17.7 17.8 10.1 300
8192 single 50 0 60.0 16.7 18.2 18.4 0.5 299
8192 single 200 0 60.0 16.7 18.8 23.0 1.9 300
8192 single 500 0 60.0 16.7 18.1 18.4 3.7 300
8192 single 1000 0 60.0 16.7 18.3 18.5 6.1 300
8192 single 2000 0 60.0 16.7 17.8 17.9 10.5 300
16384 single 50 0 60.0 16.7 18.5 18.8 0.4 299
16384 single 200 0 60.0 16.7 18.3 18.4 1.5 300
16384 single 500 0 60.0 16.7 18.4 19.8 4.3 300
16384 single 1000 0 60.0 16.7 18.6 20.6 6.4 300
16384 single 2000 0 60.0 16.7 17.7 18.0 11.8 300
4096 single 50 200 60.0 16.7 19.0 19.5 0.7 300
4096 single 500 200 60.0 16.7 18.1 18.1 3.6 300

(B) Laptop, WebGL run 2 — same header as (A)

Note: this run was launched as a WebGPU request (?renderer=webgpu) and fell back to WebGL, so the results are WebGL. Header same as (A).

Renderer: webgl, GPU: ANGLE (AMD, AMD Radeon 780M Graphics (radeonsi phoenix ACO), OpenGL 4.6), maxTex 16384, res 1.203125, viewport 1877x1058, 5000ms/scenario (+700ms warmup), chaos on, grid on, cull on UA: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36

map map path tokens strokes fps avg ms p99 ms worst ms js ms frames
2048 single 50 0 60.0 16.7 18.3 18.5 0.5 300
2048 single 200 0 60.0 16.7 18.3 19.0 1.7 300
2048 single 500 0 60.0 16.7 18.1 18.9 3.0 300
2048 single 1000 0 60.0 16.7 18.4 18.6 5.5 300
2048 single 2000 0 60.0 16.7 17.8 18.2 11.0 300
4096 single 50 0 60.0 16.7 18.1 18.3 0.6 299
4096 single 200 0 60.0 16.7 18.3 19.0 1.8 300
4096 single 500 0 60.0 16.7 18.2 18.5 3.3 300
4096 single 1000 0 60.0 16.7 18.2 18.5 5.6 300
4096 single 2000 0 60.0 16.7 17.7 18.1 11.3 300
8192 single 50 0 60.0 16.7 18.6 19.1 0.7 300
8192 single 200 0 60.0 16.7 18.7 19.3 2.4 300
8192 single 500 0 60.0 16.7 18.1 18.2 4.0 300
8192 single 1000 0 60.0 16.7 18.0 18.5 6.4 300
8192 single 2000 0 60.0 16.7 17.7 18.4 11.6 300
16384 single 50 0 60.0 16.7 18.2 18.8 0.5 299
16384 single 200 0 60.0 16.7 18.1 24.1 2.1 299
16384 single 500 0 60.0 16.7 18.0 18.5 4.5 300
16384 single 1000 0 60.0 16.7 17.8 18.3 6.7 300
16384 single 2000 0 60.0 16.7 18.1 18.6 11.7 300
4096 single 50 200 59.8 16.7 19.6 32.4 0.6 298
4096 single 500 200 60.0 16.7 18.4 18.4 3.6 300

(C) Laptop, WebGPU — Linux Chrome 155, AMD Radeon 780M

Renderer: webgpu (requested webgpu, honored), GPU: ?, maxTex 8192, res 1.203125, viewport 1877x1058, 5000ms/scenario (+700ms warmup), chaos on, grid on, cull on UA: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36

map map path tokens strokes fps avg ms p99 ms worst ms js ms frames
2048 single 50 0 59.9 16.7 17.5 17.7 0.4 299
2048 single 200 0 59.9 16.7 17.7 18.3 1.6 299
2048 single 500 0 59.9 16.7 17.6 17.7 3.8 299
2048 single 1000 0 59.9 16.7 17.2 17.5 4.5 299
2048 single 2000 0 59.9 16.7 17.2 17.3 8.8 300
4096 single 50 0 59.9 16.7 17.6 20.2 0.4 299
4096 single 200 0 59.9 16.7 17.6 17.7 1.7 299
4096 single 500 0 59.9 16.7 17.5 17.6 3.7 299
4096 single 1000 0 59.9 16.7 17.0 17.7 4.5 299
4096 single 2000 0 59.9 16.7 17.7 17.7 9.0 300
8192 single 50 0 59.9 16.7 17.7 24.9 0.4 299
8192 single 200 0 59.9 16.7 17.7 20.4 1.6 299
8192 single 500 0 59.9 16.7 17.6 18.1 3.6 299
8192 single 1000 0 59.9 16.7 17.0 17.1 4.6 299
8192 single 2000 0 59.9 16.7 17.6 17.7 8.8 300
16384 4 tiles 50 0 59.9 16.7 17.5 17.5 0.4 299
16384 4 tiles 200 0 59.9 16.7 17.7 17.7 1.6 299
16384 4 tiles 500 0 59.9 16.7 17.2 17.3 3.4 299
16384 4 tiles 1000 0 59.9 16.7 17.3 18.5 4.9 299
16384 4 tiles 2000 0 59.9 16.7 17.6 17.7 10.0 300
4096 single 50 200 59.9 16.7 17.7 17.7 0.9 299
4096 single 500 200 59.9 16.7 17.4 17.5 4.0 299

(D) Samsung Galaxy Note 10 (SM-N970F, Exynos 9825 / Mali-G76), WebGL — Chrome 156 Android

Renderer: webgl, GPU: ANGLE (ARM, Mali-G76, OpenGL ES 3.2), maxTex 4096, res 2, viewport 411x730, 5000ms/scenario (+700ms warmup), chaos on, grid on, cull on UA: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/156.0.0.0 Mobile Safari/537.36

map map path tokens strokes fps avg ms p99 ms worst ms js ms frames
2048 single 50 0 60.0 16.7 20.8 24.0 3.1 300
2048 single 200 0 60.0 16.7 19.8 20.6 4.5 300
2048 single 500 0 60.0 16.7 19.7 21.7 9.1 300
2048 single 1000 0 59.8 16.7 22.1 28.9 14.1 300
2048 single 2000 0 36.0 27.8 31.5 40.0 26.8 180
4096 single 50 0 59.8 16.7 19.8 30.1 2.8 299
4096 single 200 0 59.8 16.7 19.1 45.5 5.1 299
4096 single 500 0 60.0 16.7 18.8 20.3 9.0 300
4096 single 1000 0 60.0 16.7 19.3 21.0 13.8 300
4096 single 2000 0 34.6 28.9 30.4 30.8 28.1 173
8192 4 tiles 50 0 60.0 16.7 18.5 19.2 3.0 300
8192 4 tiles 200 0 60.0 16.7 18.9 20.4 4.5 300
8192 4 tiles 500 0 60.0 16.7 19.3 28.8 9.1 300
8192 4 tiles 1000 0 60.0 16.7 20.0 22.6 14.2 300
8192 4 tiles 2000 0 35.1 28.5 30.7 32.7 27.7 176
16384 16 tiles 50 0 60.0 16.7 20.1 23.6 3.0 300
16384 16 tiles 200 0 60.0 16.7 18.7 19.8 4.9 300
16384 16 tiles 500 0 60.0 16.7 21.0 25.7 9.8 300
16384 16 tiles 1000 0 59.3 16.9 24.2 80.2 14.5 297
16384 16 tiles 2000 0 32.3 30.9 32.6 33.4 30.1 162
4096 single 50 200 60.0 16.7 18.5 20.8 3.0 300
4096 single 500 200 60.0 16.7 19.4 24.0 9.5 300

Techniques used (v8)

  • Map larger than max texture: max texture read from the backend (gl.getParameter(MAX_TEXTURE_SIZE) / device.limits.maxTextureDimension2D); if map > that (or > the "tile size" override) it is sliced into square tiles, each its own canvas -> Texture.from(canvas) -> Sprite at an integer position. Overlay says SINGLE vs TILED. Here 16384 on a maxTex 8192 device = 2x2 tiles of 8192.
  • Culling: manual Culler.shared.cull(world, screen, false) each frame (not the plugin, so it can be toggled); map tiles and stroke sprites are cullable with bounds; tokens use a fixed cullArea rectangle (no per-frame bounds calc) and cullableChildren = false.
  • Token labels under HP churn: BitmapText with a pre-installed BitmapFont (BitmapFont.install), not Text: changing .text only rebuilds quads, no canvas raster or GPU upload. Circle bodies: one shared GraphicsContext per colour (6), tessellated once, reused by all tokens. Tokens are pooled (removed/added, never destroyed).
  • Grid: one TilingSprite over a small cell texture (1 quad regardless of map size) rather than thousands of Graphics lines.
  • Stroke baking: live stroke = Graphics chunks of <=48 points (only the last chunk is re-tessellated per move, older chunks frozen). On pointer up the chunks are rendered once with renderer.textureGenerator.generateTexture({target, frame, resolution, antialias}) into a Sprite and the Graphics are destroyed. Bake resolution follows zoom (1..2), capped so no side exceeds 4096 px.
  • Input: DOM pointer events on the canvas with a hand-rolled pan/zoom/pinch (pixi-viewport 6.0.3 declares pixi.js >=8 peer, but token drag + pen + pinch needed custom handling anyway). Pixi's federated event features are disabled; token hit test is an O(N) scan on press only.

Findings (real hardware)

Supersedes the SwiftShader-based findings of the earlier headless run.

Verdict: PixiJS v8 renders a VTT-sized scene smoothly on the laptop (Radeon 780M, both WebGL and WebGPU) and on a 2019 phone (Note 10, WebGL). Only per-frame JS for token updates under chaos scales in a way that matters.

  • 200 baked strokes: refuted as a cost. The SwiftShader result (4096/50 tokens 60 -> 38 fps) is a SwiftShader artifact, not a real-GPU effect. On real devices the strokes cost no fps; js ms rises by at most ~0.5 ms on the laptop, and the phone 4096/500 with strokes is 9.5 ms vs 9.0 ms without. Hypothesis about un-mipmapped stroke textures is moot for now.
  • Map size: ~free. The tiled path was verified on real GPUs with no measurable cost: laptop WebGPU maxTex 8192 -> 16384 map = 4 tiles; phone maxTex 4096 -> 8192 = 4 tiles, 16384 = 16 tiles. Hypothesis: the WebGPU maxTex of 8192 (vs WebGL 16384 on the same GPU) is Pixi requesting default device limits, not the adapter max.
  • Baked strokes at 200: no measurable cost on any real device (see above).
  • Only scaling cost = per-frame JS for token updates under chaos (all tokens moving).
    • Laptop 2000 tokens: js 9.7–11.8 ms (WebGL, runs A/B), 8.8–10.0 ms (WebGPU, run C). Both well under budget.
    • Phone: 60 fps (59–60) up to 1000 tokens at ~14 ms js; 2000 tokens -> 32–36 fps, js 27–30 ms -> CPU-bound.
    • Phone is ~2.5x slower than laptop on the same JS work.
  • Phone fixed overhead: js ~3 ms even at 50 tokens vs 0.4 ms on laptop. Hypothesis: overlay / culling per-frame cost. Keep small in the real app.
  • Isolated spikes, not patterns: phone worst 80 ms at 16384/1000 tokens; laptop worst 32 ms at 4096/50/200 strokes (run B). Likely GC or texture upload one-offs; not reproduced across runs.
  • fps column is vsync-capped at 60. Use js ms as the headroom metric; fps only drops once js exceeds budget.

Real-VTT risks:

  • Update only moved tokens; never all tokens per frame. Chaos at 2000 moves everything and is the worst case.
  • If mass movement is ever needed on mobile, switch to ParticleContainer (next step, not tested).
  • A single 16384 texture is ~1 GB VRAM (16384² × 4 B) on GPUs whose maxTex allows it. Consider capping texture size or forcing tiles, even where the device could take a single texture.
  • BitmapText rasterises at one font size: labels blur when zoomed in. The installed glyph set is Latin/digits only; non-Latin names need Text/HTMLText or a bigger atlas.
  • Per-stroke textures: 200 strokes = 200 GPU textures. Thousands of strokes need atlasing/merging and texture GC planning. Very long strokes are baked at a 4096 px cap and look soft.
  • Tokens are one Container + 2 children each: 2000 tokens = 6000 scene nodes touched per frame in chaos mode.
  • WebGPU header shows GPU: ? (adapter info not read). Cosmetic.

Untested:

  • HP churn timing (the Run-benchmark runs churn OFF; toggle is manual).
  • iOS / Safari.
  • WebGPU on mobile.
  • Tablets beyond the Note 10.