perf(ui): avoid building collapsed tool card content on mount - #14012
Merged
marius-kilocode merged 1 commit intoSep 10, 2026
Merged
Conversation
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Reviewed by grok-4.6 · Input: 204.8K · Output: 18.2K · Cached: 520.6K Review guidance: REVIEW.md from base branch |
marius-kilocode
enabled auto-merge
September 10, 2026 15:12
marius-kilocode
disabled auto-merge
September 10, 2026 16:19
iscekic
approved these changes
Sep 10, 2026
eshurakov
approved these changes
Sep 10, 2026
marius-kilocode
deleted the
benchmark-vscode-tool-rendering-performance
branch
September 10, 2026 16:48
This was referenced Sep 11, 2026
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.
What Problem This Solves
Mounting a VS Code tool card did a large amount of work for content the user could not see. The card's collapsed body was constructed on mount even while closed, so Markdown and tool output parsing ran and were then discarded.
Why This Change Was Made
BasicTool.hasChildren()readprops.childrento test for presence:In Solid,
props.childrenis a getter. Reading it evaluates the child expression, which builds the entire collapsed body subtree. A CPU profile of mounting grep cards showedchecksum, marked's regexes,updateBlock, andDOMPurify.sanitizeas the top self-time, while the DOM contained zero mounted tool outputs. The work was done and thrown away.The fix checks for presence without evaluating, matching the branch the component already used when
deferwas set. The collapsed body is then constructed only when it is actually rendered.User Impact
Tool cards mount faster and the transcript stays more responsive while tools stream. There is no visual change: collapsed cards still expand to the same content, and the reveal and expand animations are untouched.
Evidence
Per-card collapsed mount, 40 real cards rendered with the production components:
Tools whose bodies hold content improve; tools that already deferred or had no body are unchanged. That split confirms the fix targets the eager construction rather than general mount cost.
Limitation: these are controlled mounts of the real components, not a full interactive agent session. The gain scales with how many content-bearing cards a session mounts.
Verification
packages/ui: typecheck and unit tests pass.packages/kilo-vscode: typecheck, lint, knip, and the full unit suite pass.BasicTool, asserts a collapsed card does not construct its body, and asserts the body is built once when expanded.