feat(examples): auto-sweep mode for stress-tv (find the FPS sweet spot)#80
Merged
Conversation
Adds `?autosweep=true` to the stress-tv example. Instead of driving the grid by hand with the remote, it sweeps every tier from low to high card count, measures median FPS per step (rAF timing, with a short warm-up to skip the rebuild spike), and bisects between the last good rung and the first bad one to report the highest count that holds the target frame rate. ?test=stress-tv&autosweep=true # target 60 fps (default) ?test=stress-tv&autosweep=true&targetfps=30 Results print to the console (console.table) and an on-screen panel. The sweep reports two distinct ceilings so they are never conflated: - performance wall: the measured FPS knee (CPU- or GPU-bound) - correctness wall: the Uint16 index-buffer cap (16384 quads / glyphs) The reported sweet spot is min(perf wall, correctness wall), and counts are clamped to the cap so the sweep never builds a scene whose own text would drop. VAO is fixed at renderer construction, so A/B it with two runs and compare: ?test=stress-tv&autosweep=true vs ?test=stress-tv&autosweep=true&novao=true Also refactors buildGrid to take an explicit count so the sweep can drive arbitrary values; interactive remote controls are unchanged. Note: the correctness-wall math assumes the index-buffer fix (#79). Best reviewed/merged alongside it; without it the real cap is ~4167 and high-count tiers would drop text mid-sweep. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Adds an automatic sweep to the
stress-tvexample. Instead of driving the grid by hand with the remote,?autosweep=trueramps card count across every tier, measures FPS at each step, and reports the highest count that still holds the target frame rate — the "sweet spot."How it works
min(perf, correctness); counts are clamped to the cap so the sweep never builds a scene whose own text would drop out.console.tableand an on-screen panel.VAO A/B
VAO is fixed at renderer construction, so the runner measures the current setting and you compare two runs:
This is the honest way to settle "is VAO on actually faster on this device" — a strict win when CPU/driver-bound, neutral when GPU/fill-bound, and occasionally a wash on flaky embedded WebGL1 VAO drivers (which is exactly what
disableVertexArrayObjectis for).Verified
On a 120 Hz dev machine (target 60 fps), the sweep reported:
These match the analytical caps exactly. This machine is fast enough that FPS never dipped below 60, so the index cap binds on every tier; on a slower 60 Hz TV the FPS wall would bind first at lower counts, which the tool distinguishes.
Notes for reviewer
buildGridto take an explicit count (so the sweep can drive arbitrary values); interactive remote controls are unchanged.🤖 Generated with Claude Code