The live demo starts when it’s in view.Switch “New kinds” and watch the frame-time graph and the mid-run counter · A chunk arrives, a few a frame or all in one frame
Shaders and pipelines built ahead, never on the frame that first draws something.
What it costs a frame
GPU
0.26 ms
CPU
0.21 ms
02468101216.7 ms
GPU
0.26 ms
CPU, median
0.21 ms
CPU, 95th pct
0.34 ms
Draw calls
4
Weight
Light
Measured 11 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. What ran: Measured in “compile ahead” mode, a new kind arriving every second: the counter should stay at 0 mid-run. Phones: tiers are being measured next.
apple · Apple A19 Proin a browser tab · 16 November 2026
1.30
0.16
0.62
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 2026
0.85
0.63
0.87
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
three.js 0.187.0No other packages
What it’s for
Open worlds that stream content in
Loading screens that really load
First-shot and first-hover hitches
Vehicles and glass that stall on first view
Perf gates in CI
A chunk of a world arriving without a hitch
One per-frame allowance for many systems’ background work
Environment bakes and covered views that never stall the GPU process
Pitfalls, in brief
A compile that skips the queue (three’s own, another library’s, one the app forgot) can still overlap one in it. compileInTurn(renderer) guards the renderer itself: it patches three r187’s _beginPreCompile, _finishPreCompile and the node manager’s getForRenderAsync so compiles take turns an object at a time.
Never run two compileAsync calls on one renderer at once: in three r187 the second can throw or leave the canvas frozen with no error. showWhenCompiled queues its compiles per renderer (so five at once arrive one after another); send every compileAsync of your own through the same queue: inTurn(renderer, () => renderer.compileAsync(…)).
The queue must be one for the whole page, not one per module: each entry that compiles carries its own copy of compile-turn.ts, and a queue kept inside a module (a WeakMap of its own) only orders that module’s compiles, so in a game that used this entry and the material designer, their compiles still overlapped and blacked the canvas for good. compile-turn.ts keeps the queue on the renderer under Symbol.for("feature-library.compile-turn"), so every copy shares it.
three caches a node build by a key that includes the material and, for an instanced mesh, the object’s own id: every new material and every new InstancedMesh pays a full build (8–16 ms plus a pipeline).
compileAsync covers only the camera’s pass: each new kind of shadow caster builds its shadow pipeline synchronously on its first shadow draw (100–200 ms on D3D).
11 more in brief
three frees pipelines nothing uses: a kind that leaves view and comes back compiles again. keepPipelines() stops that (they are few and small; the compile is what costs).
Every vertex attribute is in the pipeline key, read or not: a geometry that gains a uv or colour attribute on first draw (three completes missing ones) builds again.
Under 64 KB three writes an instanced mesh’s capacity into its shader, so each new size is a new shader. keepPipelines() makes instance matrices attributes, one shader at any count (it patches NodeBuilder.prototype for every renderer on the page).
compileAsync (r185+) queues materials, not their state: a see-through double-sided material is compiled as a variant no draw uses. compileAsDrawn() queues a frozen copy as it stands in its pass.
A hidden mesh is skipped by compileAsync: show it for the compile, as showWhenCompiled does.
A skinned mesh’s bone count and its attribute list are in its build key: pad skeletons to a common size so species share builds.
A chunk warmed all at once makes every mesh’s buffers and bind groups in one frame: HaTac’s drive made 200–1,279 buffers and 130–850 bind groups in a frame and the GPU stalled 100–200 ms outside it.
Compile one mesh of each kind first and the rest after: three stores a build only when it finishes, so meshes of one kind compiled together each build it again (7–9 ms apiece).
Give the background work of every system one allowance a frame (StreamingBudget), not one each: HaTac’s ground, chunk stages, collision field and meadow had 3, 1.5 and 1.5 ms of their own and on a busy frame added up past 10 ms.
A draw that meets a missing pipeline makes it on the GPU process’s main thread, one after another (on D3D 150–300 ms each): behind a loading card let draws make theirs asynchronously (asyncDrawsWhile) and wait for them; a covered view draws with drawWithoutStalls until nothing comes back.
compileAsync skips what is hidden, so a hidden object is shown for its compile, but only for the moment the compile starts: shown for the whole compile, every frame drawn meanwhile draws it and builds its shaders on the spot, the very stall the compile was for.
16 pitfalls in full, the hook-up guide, the module source and its tests come with the part.