Repository navigation
Conversation
Measurements of the embedded GotA viewer showed each seek frame spending about as long drawing as simulating, plus a wait for the next display refresh, so a cold seek to the end of a 23,642-tick replay took 14.5 s at the 33 ms embed slice and 28 s at 10 ms. - GotA: while seeking, draw at most every SeekDrawSeconds (0.25 s); other frames only simulate, skip present, and yield without waiting for the display. The frame that lands or cancels a seek is drawn as before. - replaycontrols.nim: publishReplayControlFrame takes drawn; undrawn frames report their tick but keep the last drawn camera and size, so project and pick match the pixels on screen. Frames carry drawn to the page. - Result (same harness, headless Chromium + Metal): 33 ms 14.5 s -> 9.0 s, 20 ms 18.9 s -> 9.8 s, 10 ms 28.1 s -> 11.7 s; cancel stays under 60 ms. - Tests: replay control case for undrawn frames; the browser cold seek checks the landing frame is drawn and at most four draws a second. - Docs: docs/replay-control.md (drawn field, new slice table). The frame-loop change re-indents the draw blocks; review with git diff -w. Co-Authored-By: Claude Opus 5.5 <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.
Skip most draws while a replay seek is in flight
Depends on #102 (stacked on
replay-control).What and why
A cold seek to the end of a 23,642-tick GotA replay took 14.5 s at the 33 ms embed slice and 28 s at 10 ms. Each seek frame spent about as long drawing as simulating, then waited for the next display refresh. Pure simulation is about 8–9 s of that.
SeekDrawSeconds(0.25 s) so the view still moves. Other frames only simulate, skip present, and the main loop yields without waiting forrequestAnimationFrame. The frame that lands or cancels a seek is drawn as before, so the final frame is exact.replaycontrols.nim:publishReplayControlFrame(..., drawn). An undrawn frame reports its tick (seek progress) but keeps the last drawn camera matrix and size, soproject/pickstill match the pixels on screen. Frames carrydrawnto the page.Measurements
Same harness before and after: embedded viewer, cold seek to the last tick of the 23,642-tick replay, then cancel during a fresh long seek; host page runs a 10 ms timer. Headless Chromium with Metal, M-series Mac:
The browser test's 28,909-tick seek at 33 ms went from 16.5–17.2 s to 11.3–11.7 s. In PlayerADE's headed workbench (heavier page) the same tape went 42.6 → 14.4 s at 10 ms, 25.4 → 11.7 s at 20 ms, 18.9 → 10.3 s at 33 ms, with cancel under 100 ms. Backward seeks are unchanged (~35 ms).
Trade-off: at 33 ms and above, chained undrawn frames give the host's timers slightly fewer gaps to run in (p90 62 → 75 ms at 33 ms). Short slices now cost little seek time, so hosts that care about smoothness can use 10–20 ms. I left the embed default at 33 ms.
What to look at
git diff -w. The real change is theframeDrawndecision after simulation,if frameDrawn:around drawing/present, andif frameDrawn: waitForDisplay()in the main loop.Tests
nim r tests/test_replaycontrols.nim: pass, new case that an undrawn frame keeps the drawn camera forproject.nim r tests/tests.nim: all tests passed (with the sibling PRs merged in);nim checkGotA desktop/headless/coworld: pass.test_browser_with_playwright.py --control-only --gpu: pass; the cold seek check now asserts the landing frame is drawn and that at most four seek frames a second are drawn (e.g. 43 drawn of 284). Also passes on SwiftShader.Docs:
docs/replay-control.md(drawnfield, new slice table).🤖 Generated with Claude Code