Skip to content

perf(ui): find in a long transcript opens at once instead of drawing the whole conversation, and holds a third less memory on a phone - #804

Merged
Michael McQuade (giraffesyo) merged 1 commit into
canaryfrom
perf/find-without-drawing-all
Nov 17, 2026
Merged

Michael McQuade (giraffesyo) merged 1 commit into
canaryfrom
perf/find-without-drawing-all

Conversation

@giraffesyo

Copy link
Copy Markdown
Member

Summary

Find drew every message of the conversation while it was open, through the message list's whole, so it could search all of it. In a long agent session that froze the page for most of a second on desktop and two and a half seconds on a phone, and on a phone it took the page from about 370 MB to 820–860 MB.

Find now searches the whole conversation without drawing it:

  • While find is open, the list reads the messages it doesn't draw a few at a time, out of sight and between frames, as they would show, and keeps their text. A turn it lets go of keeps the text it showed, with whatever the reader opened in it. Expand-all or a new conversation makes it read them all again.
  • Find counts the matches in the text it has read together with those in the turns drawn. Until it has read them all, the count says more may come, as 27 of 29+.
  • Stepping to a match in a turn the list doesn't draw draws that turn and shows the match, as stepping to one on screen does. Find keeps its place by message as the count grows.
  • A match no longer runs from the end of one message into the next.

The long agent session story, searching for a phrase every shard's reply holds, stepping back through the matches, then searching for the first turn. Before on the left draws the whole conversation as find opens; after on the right draws a few turns around the match. The counter shows the elements each transcript holds:

find.mp4

A match in the third of forty turns, at desktop and phone width:

Find showing a match far back in the long agent session at desktop width

Find showing a match far back in the long agent session at phone width

The count while the list is still reading, on a page slowed so it shows:

The find bar counting 27 of 29+ while it reads

whole still draws every message for a host that asks for it; SessionView no longer does. While find reads, a host's own tool renderers draw once for each turn, as they do when the reader scrolls past it.

Testing

  • SessionView.find.test.tsx: finds in a turn the list doesn't draw and draws it to show the match, counts the matches in turns it doesn't draw without drawing them all, says more may come while it reads, and steps from the last turn to a match in the first. ChatMessageList.window.test.tsx: reveal draws a message's turn with the message at the top, the list reads the turns it doesn't draw a few at a time and only while asked, keeps the text of a turn it lets go of, and forgets what it read when expand-all changes. Each fails with the code it covers broken (14 cases).

  • Measured in a host app's production build against an agent session of 100 turns with 4,000 tool calls and 800 edits, before and after built from source the same way, three rounds each, alternating:

    Find in the long session Before After
    Chromium: find bar shows after 502–513 ms, page blocked 398–451 ms 94–106 ms, not blocked
    Chromium: elements and heap with find open 67,403, 72 MB 2,626, 32 MB
    Chromium: a match in turn 50, count final after 291–301 ms, blocked 248–257 ms 75–76 ms, blocked 50 ms
    Chromium: 100 matches, count final after 163–172 ms, blocked 127–131 ms 25–32 ms, not blocked
    WebKit at phone size: find bar shows after 2,444–2,457 ms 99–102 ms
    WebKit at phone size: elements and page memory with find open 66,973, 820–860 MB 2,196, 533–541 MB
    WebKit at phone size: a match in turn 50, count final after 1,230–1,464 ms 179–180 ms
    Opening the session 1,343–1,417 ms 1,335–1,352 ms

    Both found the same matches and showed the same one. The page opens at 358–381 MB in both; on a phone the after build keeps about 170 MB more once it has read every turn, which Chromium's heap after collection doesn't show (29 to 32 MB), so it is memory WebKit hasn't returned rather than anything kept.

Checklist

  • make check passes: its TypeScript half (lint-js, test-js, verify-build); no Go changed
  • A new or changed shared message is in every language in problem/messages/ (none)
  • No code, rule or param was renamed (they are API contract)

…the whole conversation, and holds a third less memory on a phone

Find drew every message of the conversation while it was open, through the
message list's `whole`, so it could search all of it. On a long agent session
that froze the page, and on a phone it took more memory than the tab had.

Find now searches the whole conversation without drawing it:

- The list reads the messages it doesn't draw a few at a time, out of sight
  and between frames, as they would show, and keeps their text. It reads
  only while find is open, and keeps the text of a turn it lets go of as the
  reader left it.
- Find counts the matches in the text it has read along with those in the
  turns drawn. Until it has read them all, the count says more may come.
- Stepping to a match in a turn the list doesn't draw draws that turn and
  shows the match, as stepping to one on screen does.
- A match no longer runs from one message into the next.

`whole` still draws every message for a host that asks for it;
`SessionView` no longer does.
@giraffesyo
Michael McQuade (giraffesyo) merged commit 1724937 into canary Nov 17, 2026
8 checks passed
@giraffesyo
Michael McQuade (giraffesyo) deleted the perf/find-without-drawing-all branch November 17, 2026 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant