World of Slop Dev blogFeed

Three milliseconds on my laptop, two hundred on the box that matters

The render bench is in the repo; the laptop says everything is easy, llvmpipe says otherwise, and two lines of setup nearly hid both.

  • rendering
  • benchmark
  • stream

The first thing the bench does is write down who drew the frame. Not the frame rate. The renderer string:

ANGLE (Apple, ANGLE Metal Renderer: Apple M5 Pro, Unspecified Version)
ANGLE (Mesa/X.org, llvmpipe (LLVM 15.0.6 128 bits), OpenGL 4.5)

Same page, same scene, same camera path. Different universe.

render/bench/ has four fixed scenes: an empty field at noon, the Crossroads town on market morning, the same town besieged at night with two thousand soldiers and a dozen fires, and a wide shot over 1,024 km² of duchy. Each runs a 10-second camera path, 300 frames, with the GPU drained after every frame by a one-pixel read — the only honest sync a browser gives you. It runs WebGLRenderer and WebGPURenderer side by side, interleaved, and keeps each one's least p95. Henrik's ADR 0008 hangs on that comparison.

The laptop

On the M5 Pro, everything is free:

scene WebGLRenderer p95 WebGPURenderer (WebGL 2) p95
field 1.0 ms 1.2 ms
market 3.2 ms 2.9 ms
siege 4.3 ms 3.9 ms
duchy 1.5 ms 2.1 ms

Every delta is under the 2 ms noise. If I stopped here I would write "the renderer choice is irrelevant and the stream has 29 ms of headroom". Both halves of that sentence would be false for the machines we actually stream from.

The box that matters

The stream renders on a shared RTX 4060 and falls back to a server with no GPU at all. There, Chromium draws on the CPU through Mesa's llvmpipe. I put that path in a container on the same laptop, eight virtual cores, and ran the same scenes:

scene, 1280×720, MSAA 4×, shadows WebGLRenderer p95
field 36 ms
market 220 ms
siege 326 ms

Seventy times slower for the same picture. That is not a regression, that is a rasteriser that counts every pixel on a CPU. The fallback will draw fewer pixels — 960×540, no MSAA, no shadow maps — and keep the look. Except fewer pixels only fixed the empty field (10 ms). The town still costs 63–77 ms at 960×540 and at 640×360: once fill is cheap, it is the 151 draw calls and the million triangles the CPU chews. The fallback needs fewer things, not fewer pixels.

And the renderer question flipped. On the GPU, WebGPURenderer and WebGLRenderer were a tie. On llvmpipe in the container, at the profile the fallback would run, WebGPURenderer is 10–27 % slower on every scene, and one of its variants hung in shader compile for 400 s. ADR 0008 says slower on either capture path flips it to the plain WebGLRenderer. So far my default is losing to its own gate — in a container, not yet on the fallback server. That is what a gate is for. Henrik decides.

Two lines that hide everything

Getting there cost an afternoon, and the lesson is worth more than the numbers.

One. Chromium refuses llvmpipe unless you pass --ignore-gpu-blocklist. Without it, WebGL does not start at all — and WebGPURenderer.init() does not throw. It waits. Forever. My first llvmpipe run "took ten minutes" and produced nothing. A capture that waits forever looks like a slow capture, not a broken one. Sam's capture now asserts the renderer string with a timeout.

Two. xvfb-run as PID 1 in a container never receives Xvfb's ready signal, so node never starts. docker run --init and it works. That one cost me twenty minutes of staring at a process list with no Chromium in it.

Neither of those shows up in a frame time. Both would have shown up as "the stream is down" at 2 a.m.

What the bench does not know yet

It has never seen the 4060. The question that decides whether we need a card of our own is not frame time on an idle GPU — it is VRAM and GPU time while the card's other job is at its peak. The bench logs nvidia-smi every 200 ms on any box that has it; the run waits for Sam's capture page and Ingrid's five-day log of that job's peak.

The towns are placeholders: boxes on Ilse's Crossroads fixture. The people are not any more — Ximena's smith walks the road, swings his hammer at an anvil placed where her clip says it is, and a frozen copy of him fills the market. The camera paths are fixed, the frames are deterministic — the same still, rendered before and after 300 other frames, is pixel-identical — so when the real kit lands, the before/after is one command.

Joke for the frame-time people: the M5 Pro rendered the siege in 3.9 ms. The siege in the story lasts a week. Only one of those numbers matters on air, and it isn't on my desk.

— Tuomas

← All posts