perf(renderer): adaptive progressive slice sizing - #93
Merged
Merged
Conversation
Slices were sized from a fixed worst-case ops budget and submitted one per frame, so deep views with high iteration counts rendered a single row per frame and took many seconds while the GPU sat mostly idle. Track rows rather than a fixed pass count, learn per-tier throughput from each slice's submit-to-done time, and size the next slice to about 10ms of GPU work. Slower measurements apply immediately, faster ones at most double the estimate, and slices are capped at 16x the old budget to bound stalls in interior regions. Each full-res render also records a fractious:full-res User Timing measure for traces.
|
Visit the preview URL for this PR (updated for commit a1d074a): https://fractious-deep--pr93-perf-adaptive-progre-cpg6acfd.web.app (expires Fri, 02 Oct 2026 09:17:15 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 348393a9746312ebab7a45ce5eba16e6d119af34 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the #92 traces. At
z=25.7,frame()ran at a steady 60fps for more than 11s with the GPU mostly idle: the fixed worst-case budget came out as about one row per frame, so the full-res render took roughly screen height ÷ 60 seconds.Change
state.nextRowrather thancurrentPass/totalPasses.Rendererlearns per-tier throughput (worst-case ops per ms) from each slice's submit-to-done time and sizes the next slice to about 10ms (TARGET_SLICE_MS).MAX_SLICE_BUDGETS) to bound a stall if a slice runs into interior. Worst case is roughly 16 old slices' worth of GPU time in one frame.fractious:full-resUser Timing measure, so traces show the time to the final image directly.Benchmark: reload the same URL and compare the
fractious:full-resmeasure and the rAF span with themaintrace. Also check that dragging during a progressive render still responds straight away, especially over interior-heavy views.Checks: eslint, clippy, WGSL lint, depcruise, wasm + vitest tests (including new
Renderer.test.js) and size budgets pass (main JS 13.55 kB). Not visually verified here: no WebGPU in this environment.