perf(agent-manager): render terminal output with WebGL and pause hidden terminals - #13406
Conversation
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Previous Review Summaries (2 snapshots, latest commit 80024c0)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 80024c0)Status: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (9 files)
Fix these issues in Kilo Cloud Previous reviewStatus: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (9 files)
Reviewed by grok-4.6 · Input: 96.6K · Output: 15.4K · Cached: 551.2K Review guidance: REVIEW.md from base branch |
…nd keep hidden terminal layout size
Measured performance improvementMeasured on an isolated VS Code dev build with the self-test harness: 7.2s streaming capture (1500-line script output), webview performance profile.
The visible-path win comes from removing browser layout/paint and per-cell DOM churn; the JS parse cost is unchanged because xterm must parse the output regardless. Background terminals now spend no render work on output nobody sees. |
Streaming terminal output in Agent Manager (background setup scripts, Run/Setup flows) was expensive in two independent ways. The DOM renderer creates one element per cell per row, so sustained output dominated main-thread work with per-cell churn and a layout/style pass per render cycle. Terminals hidden in the background had no sharing benefit either: visibility was toggled with opacity only, so hidden terminals kept their render loop running at full rate for output nobody sees.
This change makes each of those parts cheap:
display: none. xterm 6's render service observes the screen element, pauses hidden terminals (rAF loop, model updates, GPU draws), and replays a full refresh on reactivation; the existing fit + refresh activation repaint stays as insurance.Measured on a 7s streaming capture (isolated webview): layout duration 92 ms to ~0 ms, recalc-style 122 ms to ~0 ms, layout count 262 to 2; hidden-terminal streaming dropped from an identical full-rate render pipeline to parser work only. No bundle size change.
Includes the batcher unit tests and the changeset.