The live demo starts when it’s in view.Drag the gates on the plate · the sliders set each field's strength · point at the plate for counts · click the ROC to stand the block gate there · Fire a burst
A classifier's scores drawn as a particle beam.
What it costs a frame
GPU
1.38 ms
CPU
0.33 ms
02468101216.7 ms
GPU
1.38 ms
CPU, median
0.33 ms
CPU, 95th pct
3.20 ms
Draw calls
0
Weight
Moderate
Measured 14 November 2026 on RTX 4060 Laptop, 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 157, 1920×1080 at 1×. 600 frames × 3 rounds, median kept (rounds ranged GPU 0.73–1.69, CPU 0.20–0.33 ms). What ran: The day plays at 20 minutes a second with the beam at 1,200 particles a second at the busiest hour (32,768 particles, 16,384 sparks, five fields, bloom at a quarter size), a burst fired every 4 s and the quarantine gate swept back and forth, so the gates spark and the histograms ease; the ROC canvas is drawn in the same frame. Timed with its own timestamp queries. At rest (paused, or reduced motion) a frame costs nothing. Phones: tiers are being measured next.
apple · Apple A19 Proin a browser tab · 16 November 2026
0.53
0.48
4.48
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 2026
1.77
0.45
2.46
Bars against one 16.7 ms frame. A browser-tab run is timed in a visible tab without the tool’s scripted input, so read it as close, not exact.
What it needs
Renders with
WebGPUNeeds WebGPU: current Chrome and Edge, Safari 26+, Firefox 141+ on Windows.
Your browser
Checking…Looking for WebGPU
Depends on
NothingNo other packages
What it’s for
Show where a model's thresholds fall, and what moving them costs
A score distribution that fills as the data arrives
The ROC and the histogram as one picture, lit by the same data
How much each signal contributes to a score
Spam, fraud, quality checks, alerts: any two-class decision with a review band
A showpiece for a model review or a dashboard
Pitfalls, in brief
The beam is a picture of the data, not the data: it fires a sample at a rate, and the positives far more often than they occur (the demo 8×), so they show.
The path is closed form: x at depth y is the sum of weight × signal × smoothstep over each field's band.
Scores are clamped at the far end of the plate (zmax).
setHist wants exactly packHist's layout (200 bins, log heights, then the ROC on its log x).
The plate's glow is a running histogram with memory (it fades with a 1.8 s time constant), drawn over the exact histogram's shape.
7 more in brief
Truth after landing: by default a positive flies the same colour as everything else and flares a moment after it lands (as reports come in).
The canvas takes no pointer: the gates, sliders and time strip are page elements over it, so they stay focusable and labelled, and work without WebGPU.
It rests: with nothing fired for the flight time plus a spot's life and a few seconds, frame() submits nothing.
Reduced motion: no beam (calm), the fill keeps a steady light, and it draws only on a change.
Several canvases share one device: the ROC is encoded in the same command buffer as the instrument, so its glow is the same frame's phosphor.
A software adapter (isFallbackAdapter) is refused: createPhosphorBeam resolves null and the page draws the SVG still.
A lost device (a driver reset, a sleeping laptop) sets lost and calls onLost, and frame() does nothing from then on: draw the still and say so, as the demo does.
12 pitfalls in full, the hook-up guide, the module source and its tests come with the part.
Where it comes from
From HaTac. Fully custom code.
Mark Jarzynski & Marc Olano, Hash Functions for GPU Rendering (2020): The PCG hash, the same in TypeScript and WGSL: every shot, spark and the demo's made-up day.
Tom Fawcett, An introduction to ROC analysis (Pattern Recognition Letters, 2006): The ROC as one point per threshold, and its area by trapezoids.
WAI-ARIA Authoring Practices Guide (W3C): The slider pattern for the gates (arrows, Page Up and Down, Home and End, a value text).
rochistogramclassifierthresholdscoringdecision gatesparticlesbeamphosphorbloomraw webgpuwgslcomputeatomicsclosed-form pathsvg fallbackrests when stilltimestamp queriesreduced motionno dependencies
Orthogonal connectors routed round every box by A* over a sparse grid, with a bend cost and a tie-break that keeps elbow corners from flipping as things move…