fix(vscode): speed up changes diff rendering - #10063
Merged
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (1 file)
Reviewed by gpt-5.5-2026-04-23 · 392,171 tokens |
imanolmzd-svg
approved these changes
May 8, 2026
jliounis
pushed a commit
to jliounis/kilocode
that referenced
this pull request
May 19, 2026
* fix: speed up changes diff rendering * fix: preserve deferred diff selection
t7tran
pushed a commit
to t7tran/kilocode
that referenced
this pull request
Aug 14, 2026
* fix: speed up changes diff rendering * fix: preserve deferred diff selection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@pierre/diffsrendering until diff bodies are near the viewport, using one shared observer and a per-frame render queue.What We Profiled
We profiled repeated Agent Manager worktree switches with the inline Changes panel open in the VS Code webview performance tools. The traces covered both mouse and keyboard-driven switching paths because both trigger the same Solid view updates and diff rendering work.
What We Found
The slow path was not primarily git diff collection. The UI blocked because switching worktrees with the inline diff open synchronously mounted and rendered many expanded
Diffcomponents. Each component invoked Pierre's DOM-heavy render path on the VS Code webview renderer thread, which showed up as longEventDispatch,FunctionCall,ParseHTML,UpdateLayoutTree,Layout,Commit, andPaintwork.We also found two secondary issues while iterating:
IntersectionObserverper deferred diff became its own hotspot, so the implementation now uses a shared observer.What Changed
Expanded diff state is now separate from expensive body rendering. Expanded files still appear expanded, but offscreen diff bodies reserve estimated height and render only when near the viewport. Multiple visible diff renders are queued one per animation frame to avoid long single tasks.
The diff controller now uses an active-watch epoch so old summary/detail/poll results are ignored after switching worktrees.
Impact
The worst profiled input block improved from roughly 3.2s before the rendering fix to roughly 7ms after shared observation and queued near-viewport rendering. The remaining work is incremental rendering as diffs approach the viewport instead of one large synchronous render burst during worktree switch.
Fixes #9818
Testing
bun run typecheckfrompackages/kilo-vscodebun run lintfrompackages/kilo-vscodebun run typecheckfrom repo rootbun run lintfrom repo root, completed with existing warnings and 0 errors