Repository navigation
Studio: load long chat history faster on Linux by mounting parked history in larger steps - #16924
Merged
Merged
Conversation
Full history on a long thread took about 60% longer to mount on WebKitGTK after the two-message steps: each widening commit has a fixed cost, and a 300-message thread needed about 142 of them. Keep the two-message step while the prepend frontier is within the message window's reach of the viewport, where new rows stay unparked and can move what the reader sees. Past it rows are parked as they land, so grow the step fourfold per frame up to CHUNK_MESSAGES. Other engines keep CHUNK_MESSAGES.
…rows past the 2-per-step level
Member
Author
|
@codex review |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Follow-up to #16854. On the Linux desktop app (WebKitGTK), loading a long chat's history became about 60 to 80% slower after #16854, because history was mounted 2 messages per frame for the whole thread (about 142 commits instead of about 9 for a 150-turn chat). The first messages appeared at the same time; the extra time was the background history load, with about 150 frames over 50 ms instead of about 30.
Fix
WebKitGTK only. Each widening step measures how far the first mounted row is above the viewport top (read after the existing anchor capture, so no extra layout pass):
FAR_MOUNT_CHUNK). The first step of every load stays at 2 so the tail paints as early as before.flushSync, and the anchor correction are unchanged.Chromium (Windows) and macOS never call the new path; their step stays
CHUNK_MESSAGES.The cap is 16 rather than 32 on purpose: 32 brought the load time back to within 2 to 6% of before #16854 with Glass off, but made single frames up to about 1.4 s on CPU-painted WebKit. 16 keeps the worst frame at the level of the 2-per-step loader.
Results
GitHub ubuntu-latest, Playwright WebKit, 150-turn heavy chat, time until all 300 messages are mounted, per-runner medians of 3 loads (two runners of different speed):
Tests
progressive-mount-controller.test.ts: the step stays small near the reader and for unknown geometry, ramps 2, 8, 16 past the reach and holds, drops back when the reader returns, never changes the step on other engines, and covers a 300-message thread in about 20 commits instead of about 142.tsc -p tsconfig.app.jsonandnode scripts/typecheck.mjs --testsare clean.