Repository navigation
Studio: browser pane opens without per-frame thread work on long chats - #17282
Conversation
- Side-panel insets are read from the chat root's children; the :scope query matched every node of the thread on each resize-observer tick of the pane's slide. - The dismiss-click guard looks for a popper wrapper before running its descendant menu query, which walked the whole chat on every press (about 10 ms at 150 turns). - A chat taller than the rows kept in reach of the reader takes the pane's width in one step: the slide re-wrapped those rows on every frame (about 200 ms of slow frames on macOS WebKit). Shorter chats keep the slide.
|
@codex review |
Codex Review Summary: ✅ CompletedThis 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. |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
[skip ci]
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Problem
Opening or closing the browser pane in a long chat still cost far more than in a short one, worst on macOS WebKit (Round 11 real runners: open 460 to 562 ms at 150 turns against 144 to 165 ms at 1 turn). #16986 already keeps distant rows out of layout; this PR removes the per-frame work that remained.
Causes
chat-page.tsxusedroot.querySelectorAll(":scope > [data-side-panel-inset]"), which matches against every node below the root (about 57,000 elements in a 150-turn chat), and the resize observer ran it on every frame of the slide: the largest single per-open cost in the Chromium profile (about 25 ms).dismiss-click-streak.tsran a descendant selector for an open menu against the whole document on every press anywhere: about 10 ms per click at 150 turns.Change
rowReachPx, about 4,500 px on a 900 px window) takes the pane's new width in one step (data-artifact-layout-instant); shorter chats keep the slide. The attribute is set or cleared on every open and close.Look
In long chats only, the chat column snaps to its new width instead of sliding when the pane opens or closes. The pane's own entrance is unchanged, and the end state is the same. The Linux desktop app already resized in one step and is untouched. Reading position through open and close (Chromium, 150 turns): at the bottom it stays at the bottom, as on main; mid-chat the top message moves 5 px (146 px on main).
Results
Real runners, 1 vs 150 turns, main measured twice (A/A), interleaved:
The Windows result held on two runners; the macOS result is one runner with three interleaved reps (the head's worst rep, 291 ms, overlaps the A/A range). The longest single frame is within noise.
Not addressed: the first pane open of a session on macOS WebKit still costs about 350 to 560 ms; it is not code loading or row layout (prefetching and hiding every row did not remove it), most likely garbage collection over a long chat's heap.
Tests
tests/dismiss-click-streak.test.tscase (fails on main) andtests/browser-pane-open-cost.test.tssource checks for the inset lookup and the one-step rule.tsc --noEmitclean; the long-chat gate passes.