Repository navigation
Add a ?bench mode to the browser page: a scripted frame-rate run - #64
Merged
Merged
Conversation
Opening the page with ?bench opens the walkers (seed 7) from their first tick and turns the camera once around the grid, closing in and back out, for 15 seconds after a warm-up (at least 1 s and 30 frames), then shows a card with the frame rate, frame time (median, p95), the page's own work per frame, GPU time from EXT_disjoint_timer_query_webgl2 where offered, the canvas size and device pixel ratio, the GPU's name and the user agent, with a "Copy results" button. Nothing leaves the device. strata/web/bench.js holds the harness; it wraps requestAnimationFrame before the engine loads so the engine's frames can be timed. strata/web/smoke/bench.cjs checks in CI that a short run finishes and shows its card on a desktop and an iPhone 13 profile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S6kaEL7kt5Fverjb6didBH
Headless Chromium draws with SwiftShader, which can take seconds a frame on a small runner: the run gets 7 minutes and the card's screenshot 2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S6kaEL7kt5Fverjb6didBH
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.
Adds a
?benchURL mode so frame rates can be measured on real hardware (a desktop GPU, a phone) in one tap. CI and headless Chromium only have SwiftShader, so no real numbers exist yet.What it does. After the page loads,
?benchopens the walkers (seed 7) from their first tick and turns the camera once around the grid (closing in and back out) for 15 s after a warm-up (at least 1 s and 30 frames, with the camera held at the start of the path, so first-frame shader compiles are not counted). The camera path is a function of the time into the run only (each frame turns and zooms by the step since the last), so runs on different devices are comparable. No C++ change: the existingenvlib_rotate/envlib_zoom/envlib_homeexports drive it. A card then shows:requestAnimationFrameintervals; capped by the display's refresh rate)EXT_disjoint_timer_query_webgl2, where the browser offers itWEBGL_debug_renderer_inforenderer string, user agent, page version (the arcade'sversion.txt)navigator.clipboard.writeTextin the click handler, falling back to selecting the text), Run again, CloseNothing is sent anywhere.
?bench=30runs for 30 s. The card puts its buttons above the details so the Copy button is on a phone's screen without scrolling.How.
strata/web/bench.jsis the harness; it loads before the engine's script and, in bench mode only, wrapsrequestAnimationFrameso the engine's frames can be timed and bracketed with timer queries. Without?benchthe page is unchanged (a bench run does not overwrite the remembered world either).Tests.
strata/web/smoke/bench.cjsruns a 3 s bench in headless Chromium on the desktop and iPhone 13 profiles and checks that the run finishes, frames were timed, the card shows its numbers, the Copy button is at least 44 px tall and on screen, the card fits the screen width, and Copy puts the text on the clipboard. The numbers are not checked or kept (SwiftShader). Locally, the build, the view tests under Node, the existing smoke test (desktop) and the bench smoke (desktop + iPhone 13) passed.drafted by Claude on behalf of Daniel Stephenson
🤖 Generated with Claude Code
https://claude.ai/code/session_01S6kaEL7kt5Fverjb6didBH