Add a QuadSurface::gen() perf-regression bench (no scroll data)#1081
Open
robert-kofler42 wants to merge 1 commit into
Open
Add a QuadSurface::gen() perf-regression bench (no scroll data)#1081robert-kofler42 wants to merge 1 commit into
robert-kofler42 wants to merge 1 commit into
Conversation
gen() generates every rendered surface tile and its warp helpers / per-surface caches were recently optimized and made thread-safe, but nothing guarded them against a future regression. This adds bench_quadsurface_gen, mirroring the existing VC_RUN_BENCHES microbenches (bench_volume_sample etc.): it builds a synthetic in-memory QuadSurface — no scroll data — and times gen() with normals + a non-zero w-offset so the bilinear coords warp, the validity warp, the nearest normal warp and the offset-along-normal pass all engage. It compares a WARM path (one surface reused, so _normalCache / _validMaskCache and the thread_local scratch are built once, as in steady-state rendering) against a COLD path (fresh surface each iteration, caches rebuilt). WARM must be faster than COLD; the gap is large (~25-40x here), so the assertion is robust on shared CI while still catching a broken cache reuse. The headline WARM throughput is printed so warp regressions are visible on manual runs. Opt-in via VC_RUN_BENCHES (out of default ctest), always built as a target.
|
Someone is attempting to deploy a commit to the scroll Team on Vercel. A member of the Team first needs to authorize it. |
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.
Why
QuadSurface::gen()generates every rendered surface tile (coords + normals + validity) and is on the renderer's hot path. Its warp helpers and per-surface caches (_normalCache,_validMaskCache, thethread_localscratch) were recently optimized and made thread-safe — but nothing guards them against a future regression. This adds a microbenchmark in the same style as the existingVC_RUN_BENCHESbenches (bench_volume_sample,bench_chunked_plane_sampler).What
bench_quadsurface_genbuilds a synthetic in-memoryQuadSurface(no scroll data) and timesgen()with normals + a non-zero w-offset, so the bilinear coords warp, the validity warp, the nearest normal warp and the offset-along-normal pass all engage. It compares:WARM must be faster than COLD. The gap is large (~25–40× on my machine, single- and multi-threaded), so the relative assertion is robust on shared CI while still catching a broken cache reuse. The headline WARM throughput (~160 Mpixel/s here) is printed so warp regressions are visible on manual/opt-in runs.
Notes
VC_RUN_BENCHES(kept out of defaultctest), always built as a target.main.🤖 Generated with Claude Code