Skip to content

perf(transcript): bound the tail window, stop forced layout per push, idle cache write (#1475) - #1482

Merged
currentbits merged 3 commits into
mainfrom
coder/perf-f-transcript-window-layout-switch-77991b
Oct 5, 2026
Merged

currentbits merged 3 commits into
mainfrom
coder/perf-f-transcript-window-layout-switch-77991b

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Part of #1475. Fixes renderer findings 2 (the transcript grows without bound) and 3 (forced layout on every push), and the localStorage part of finding 6.

What changed

Measured (worker, production build, seeded 1,000-message thread, headless Chromium, medians of 3):

before after
DOM nodes after 7 streams 65.3k 16.6k
JS heap 62.5 MB 33.5 MB
Blocked ms/s, 7th stream 143 2
Dropped frames 26.9% 8.5%
Keypress → frame, max 124 ms 47 ms

Thread-switch time is unchanged in this harness. On real data, the remaining switch cost is provenance, which #1478 fixed.

Verified independently

  • Typecheck: exit 0.
  • Renderer suite: 2708 of 2708 passing.
  • New tests run against main's code: 6 fail (idle write, pin-before-paint, window advancing, Show earlier after trimming, character budget).

🤖 Generated with Claude Code

Willem and others added 3 commits October 5, 2026 20:57
Streaming into an open thread kept the window's start index, and the
120-entry cap ignored size, so six long answers took one transcript from
24.7k to 62.2k DOM nodes. The tail window is now capped at 120 entries
and 100k chars of message text. While the view is stuck to the bottom,
appends advance the start; scrolled up, the start stays put, and Show
earlier pages entries back in as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The pin layout effect read scrollHeight after every push, forcing a
synchronous layout (~25-30 ms/s while streaming). It now pins before
paint only for #607's cases: opening or switching a thread, and a new
permission or question card (plus any pending forceStick). Plain appends
are pinned by the existing ResizeObserver once the browser has laid out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stringifying a 3 MB detail into localStorage took ~17 ms inside the
thread-switch frame. The write now waits for requestIdleCallback (2 s
timeout, setTimeout where it is missing), and saves made before then
coalesce into one write of the latest detail. A load in that gap returns
the pending detail.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@currentbits
currentbits merged commit 21242fa into main Oct 5, 2026
6 checks passed
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