Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(web): reduce minimap work during streaming and scrolling #9771

Closedt3dotgg(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromt3code/perf-web-minimap-workopened View on GitHub

Streaming rebuilt full minimap previews for every loaded turn. Scrolling rewrote every marker's visibility attribute, even when nothing changed.

The minimap now reuses previews by immutable message identity and skips unchanged marker writes. Its cache keeps only the latest projection, so unused completed replies do not retain extra preview strings. Preview text, row indexes, geometry, and navigation stay unchanged.

Checks

  • All 241 focused tests and web typecheck passed. Lint has no new warnings.
  • The Node source proof reduced a 10-turn update from 0.266 ms to 0.017 ms. A 1,000-turn stress case fell from 29.74 ms to 0.26 ms.
  • Repeating unchanged geometry for 1,000 markers produced zero attribute writes instead of 100,000 across 100 scroll events.
  • Parity, ref recycling, old-snapshot collection, and retained-history cache checks passed.

Small cold cases added about 0.002 ms or improved. The 1,000-turn cold stress case added 0.23 to 1.2 ms across runs. These are source measurements, not browser frame times. No browser or device run was used.

Created with GPT-6 Astra (preview) in Codex.


Note

Low Risk UI-only performance refactor in the timeline minimap with behavior-preserving tests; no auth, data, or API changes.

Overview Reduces chat timeline minimap cost during streaming and scroll by caching preview text and skipping redundant DOM updates.

Minimap item building moves from MessagesTimeline.tsx into createTimelineMinimapProjector: a stable projector caches compact user/assistant preview strings keyed by ChatMessage object identity, evicts previews not in the latest projection, and still updates rowIndex when rows reorder. Scroll handling delegates to updateTimelineMinimapMarkers, which sets each strip’s data-in-view only when visibility actually changes (including remounted/recycled refs).

The component keeps one projector instance via useState(createTimelineMinimapProjector) instead of recomputing all previews on every row change. New unit tests cover marker write counts, ref recycling, cache reuse, and parity when turns reorder or supersede earlier replies.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 1e9eca825767e9c615dda1329d65e59b982d12e4. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Cache minimap previews and skip redundant marker writes in MessagesTimeline

  • Extracts minimap projection and marker-update logic from MessagesTimeline.tsx into MessagesTimeline.logic.ts
  • createTimelineMinimapProjector caches preview strings by ChatMessage object identity for only the latest projection, scans rows backward to pair each user row with its first assistant row, and returns null for blank previews
  • updateTimelineMinimapMarkers resolves the visible interval from scroll state, computes row intersections using finite row positions, and writes dataset only when the marker's visible state actually changes
  • Risk: resolveTimelineRowTop and resolveTimelineRowHeight return false when row positions are non-finite; marker visibility falls back to false in that case
Macroscope summarized 1e9eca8.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire13.8 KiB13.6 KiB−167 B (−1.2%)15.1 KiB✅
      CodexThread snapshot wire7.0 KiB7.0 KiB−6 B (−0.1%)7.3 KiB✅
      CodexLive turn WebSocket wire6.7 KiB6.6 KiB−161 B (−2.3%)7.8 KiB✅
      CodexLive turn WebSocket decoded58.5 KiB57.1 KiB−1.4 KiB (−2.4%)66.4 KiB✅
      CodexLive turn messages10100 (0.0%)21✅
      ClaudeTotal thread wire13.7 KiB13.6 KiB−194 B (−1.4%)15.1 KiB✅
      ClaudeThread snapshot wire7.0 KiB7.0 KiB−1 B (−0.0%)7.3 KiB✅
      ClaudeLive turn WebSocket wire6.7 KiB6.5 KiB−193 B (−2.8%)7.8 KiB✅
      ClaudeLive turn WebSocket decoded59.3 KiB57.8 KiB−1.5 KiB (−2.5%)66.4 KiB✅
      ClaudeLive turn messages109−1 (−10.0%)21✅

      Baseline: 8e056a0 · PR result: 1e9eca8 · Source CI: success

      Scenario and decoded snapshot size

      10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

      • Codex decoded thread snapshot: 113.8 KiB
      • Claude decoded thread snapshot: 114.5 KiB

      Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

    3. Approvability

      Verdict: Approved at 1e9eca8

      Macroscope's review found this PR approvable — This is a localized, behavior-preserving minimap performance refactor that caches immutable previews and avoids redundant marker DOM writes. Focused tests cover streaming updates, row reordering, cache eviction, and recycled references, with no API, schema, security, billing, or deployment changes.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Superseded by #11181 (W15): minimap previews are now formatted only when opened, so unbounded preview construction during streaming is no longer needed.

    5. juliusmarminge closed this

Sign in to join this conversation.