Skip to content

perf(renderer): adaptive progressive slice sizing - #93

Merged
rowan-m merged 1 commit into
mainfrom
perf/adaptive-progressive-slices
Sep 25, 2026
Merged

rowan-m merged 1 commit into
mainfrom
perf/adaptive-progressive-slices

Conversation

@rowan-m

@rowan-m rowan-m commented Sep 25, 2026

Copy link
Copy Markdown
Owner

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

  • Progressive state is now state.nextRow rather than currentPass/totalPasses.
  • Renderer learns 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).
  • Slower measurements apply immediately; faster ones at most double the estimate.
  • Slices are capped at 16× the old fixed budget (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.
  • The first slice uses the old budget, so behaviour starts where it did.
  • Interactive previews are unchanged: one full low-res slice.
  • Each full-res render records a fractious:full-res User Timing measure, so traces show the time to the final image directly.

Benchmark: reload the same URL and compare the fractious:full-res measure and the rAF span with the main trace. 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.

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.
@github-actions

Copy link
Copy Markdown

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

@rowan-m
rowan-m merged commit a795ece into main Sep 25, 2026
2 checks passed
@rowan-m
rowan-m deleted the perf/adaptive-progressive-slices branch September 25, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant