Skip to content

perf(vscode): reduce long-session switch overhead#10823

Merged
marius-kilocode merged 5 commits into
mainfrom
perf/vscode-slim-transcript-payload
Jun 2, 2026
Merged

perf(vscode): reduce long-session switch overhead#10823
marius-kilocode merged 5 commits into
mainfrom
perf/vscode-slim-transcript-payload

Conversation

@marius-kilocode

@marius-kilocode marius-kilocode commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Follow-up to #10810.

Long VS Code transcripts still carried data and markup that the transcript renderer did not need. Patch-heavy histories sent full diff patches and encrypted OpenAI reasoning replay blobs across the VS Code extension-to-webview IPC bridge during transcript reconciliation. Completed historical labels also mounted shimmer layers even though they would never animate. Both costs accumulate as sessions grow.

The optimized paths are shared by the VS Code transcript surfaces, including the sidebar, editor tabs, and Agent Manager. Agent Manager exposed the largest historical sessions during profiling, but the improvement is not limited to Agent Manager.

What changes

  • Slim transcript snapshots and live updates immediately before the extension posts them to the webview. Keep the fields needed for transcript summaries and diagnostics, but omit summary.diffs[*].patch and metadata.openai.reasoningEncryptedContent from the display copy.
  • Render inactive historical TextShimmer labels as plain text until that component instance has actually been active. Once a live label has shimmered, keep its existing layered markup so the completion fade-out still works.
  • Preserve whitespace semantics for the plain inactive label path without reintroducing shimmer layers.

Behavior and data boundaries

There is no intended user-visible behavior change. Transcript history remains loaded, diff summary rows still show filenames and change counts, collapsed tools still expand, scrolling remains unchanged, active tool labels still shimmer while work is running, and completed live labels retain their fade-out.

The metadata slimming is extension-only and copy-on-write. The CLI backend remains the source of truth for session continuation, provider prompt caching, retry, fork, share, export, and cloud-agent storage. The webview never sends its slimmed transcript parts back into those flows. Opening a historical Changes view still fetches the full message from the backend, so line-level patches remain available when requested.

Profiled impact from this PR

  • Patch-heavy transcript reconcile payload: 12.20 MB -> 1.62 MB, an 87.4% reduction. This removes about 10.6 MB from the routine webview IPC path and makes that reconcile payload about 7.5x lighter.
  • Large static autonomous transcript: avoid 768 retained DOM nodes by rendering 256 inactive historical shimmer labels as plain text instead of three nested shimmer nodes each.
  • Warm activation median for that static autonomous transcript: 453 ms -> 441 ms, about 3% lower. Repeated post-change batches ranged from 434-443 ms, so the defensible improvement is 2-4% on top of fix(vscode): defer collapsed historical tool details #10810.
  • Representative shimmer-cleanup trace: layout work 483 ms -> 419 ms (13% lower) and style recalculation 419 ms -> 345 ms (18% lower).
  • The whitespace-preservation follow-up is performance-neutral: shimmer-only median 442.8 ms, whitespace-safe median 440.9 ms.

Cumulative context with #10810

The larger visible switch improvement comes from this PR layered on #10810, which stopped collapsed historical edit-family and bash cards from eagerly mounting hidden details and consolidated timeline hover infrastructure.

  • Deterministic fixture cold activation: 619 ms -> 172 ms, 72% lower (3.6x faster).
  • Deterministic fixture warm activation: 399-440 ms -> 159 ms, 60-64% lower (2.5-2.8x faster).
  • Real-session scripting reductions measured by transcript shape: edit-heavy 13%, patch-heavy 34%, bash-heavy 37%, and mixed 30%.

@kilo-code-bot

kilo-code-bot Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files, incremental from ba9f686)

New in this increment:

  • packages/ui/src/components/text-shimmer.css — adds white-space: pre to the top-level [data-component="text-shimmer"] selector, aligning the container with the already-pre child [data-slot] rules so the plain inactive fallback text preserves whitespace correctly.
  • packages/kilo-vscode/tests/unit/textshimmer-no-timer.test.ts — adds a regression guard asserting the new white-space: pre rule is present in the CSS. The regex [^}]*white-space:\s*pre; correctly handles multi-line CSS blocks and the stripComments pass correctly strips the trailing kilocode_change comment before matching.

Carried from prior review (no changes):

  • All 14 files reviewed in the previous increment remain unchanged.

Notes

white-space: pre on container: Child [data-slot] elements already had white-space: pre. Adding it to the parent [data-component="text-shimmer"] ensures the plain-text fallback (rendered directly inside the container when shimmer() is false) is also treated as preformatted text. This is the correct fix for the whitespace-preservation follow-up described in the PR — performance-neutral per the profiling data.

Regression guard validity: stripComments removes /* kilocode_change - preserve inactive fallback whitespace */ before the regex runs, leaving white-space: pre; which the pattern matches. The [^}]* in the regex matches newlines in JS (it is any char except }), so multi-line blocks are handled correctly.


Reviewed by claude-4.6-sonnet-20260217 · 207,008 tokens

Review guidance: REVIEW.md from base branch main

@marius-kilocode marius-kilocode changed the title perf(vscode): slim transcript payloads perf(vscode): reduce long-session switch overhead Jun 2, 2026
@marius-kilocode marius-kilocode merged commit 7d23ad5 into main Jun 2, 2026
19 checks passed
@marius-kilocode marius-kilocode deleted the perf/vscode-slim-transcript-payload branch June 2, 2026 19:10
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.

2 participants