Insights
The scenes had to hold the frame
· performance · scenes
The math gate proves the scenes compute what they claim. It says nothing about whether they compute it in time. A hero that renders a true simulation at 24fps is still a dropped-frame bug — the claim and the experience are different properties, and only one of them was gated.
This is the story of closing that gap: a headed-GPU frame census across every mounted scene, and what it actually took to bring all of them to the vsync floor.
The census, and why it runs headed
perf-census.mjs loads each route, finds its hero mount, and samples rAF deltas for two seconds — mean, p95, worst, and the share of frames past 33.4ms, a dropped 60fps frame. The flag that matters is --headed: it opens a real window and uses the GPU. Headless Chromium rasterizes on CPU through SwiftShader, which inflates WebGL scenes badly — those numbers are a relative smell test, not a budget. A budget is only real measured the way users meet it.
The first full census found five scenes over budget: flow at 24.9ms mean with 36% of frames late, stream at 21.5/21%, hexlat at 23.6/34%, bridge at 22.3/26%, brain at 21.4/21%. The other twenty-seven sat at ~17.5ms — the floor — including scenes running far heavier math. That spread was the first clue: the budget was never about how much physics ran. It was about how the result reached the screen.
Two scenes, one bug shape
flow.js and stream.js carried the same defect in different clothes: every frame re-stroked every particle’s entire trail polyline — up to 44 points across ~300 particles — purely to keep trail brightness uniform, when the 0.11 fade pass already supplied persistence. Roughly 85% of the stroked geometry was identical to the previous frame’s. The fix strokes only the newest head points per frame; older trail decays through the same fade, like real dye. Pixel probes against pre-change frames held the picture honest — lit coverage 88% and 94%, mean luminance ~99% of baseline — while mean frame time fell to the floor and dropped frames went to zero and two percent.
hexlat.js needed a different answer for the same disease. Its resting lattice was already baked once; the cost was ~830 of 880 cells glowing every frame because the damped wave never lets the field decay. The fix added a perceptual floor — cells below 0.08 glow skip their highlight stroke, sub-visible by construction — with exact alpha compensation so base-plus-highlight composes to precisely the old alpha. Threshold sweep measured the trade: 0.01 gave 21.1ms, 0.05 gave 18.6, and 0.08 shipped at 17.5 with zero drops.
bridge.js needed nothing at all. A re-census showed its 22.3ms reading was noise — the baked-strand overlay had already shipped in an earlier commit. The census’s own discipline caught that too: re-measure before fixing.
The scene that took three passes
brain.js is the honest case study in measure-don’t-guess. Headless profiling of the LIF model showed stepNet at ~0.005ms per step — the physics was never the cost. The first hypothesis, splice-inside-the-arrival-loop, was measured and ruled out: the slow steps occurred at zero arrivals. The second, allocation churn, was real but marginal — pooling the spike records cut steady-state allocation to ~zero and GC events from 38 to 35 over 200k steps. That shipped on its own evidence, labeled honestly as hygiene rather than a fix. The third pass found the actual cost: ~430 d3.select allocations per frame, 320 dead-slot opacity writes every tick, a ~300-vertex scope path rebuilt per frame. The decisive realization was simpler than all of them: the event queue is particle rendering, and ~324 animated SVG circles were the rasterization bill. Moving dots, halos, and rings to a canvas layer — tissue SVG below, scope SVG above, paint order preserved — took the scene from ~19–21ms to 16.6–17.2ms. The floor.
What the gate now guarantees
Every scene change runs npm run perf — the headed census — beside the math gates. A scene that computes truly but renders late fails the same way a scene that renders beautifully but computes falsely does. The budget is not aspirational; it is measured the way users meet it, and fixes are proven by interleaving local builds against production in the same session, not by trusting one quiet run.
Thirty-two mounts, all at the vsync floor. Two documented exceptions remain, and both are costs of admission rather than recurring defects: serverRoom’s one-time 866KB SVG rasterize at mount, and crossing’s chunked geodesic build amortized across frames. Everything else holds 60fps because the frame budget was treated as a property to prove — the same standard the math already lives under.