Performance audit: identified hotspots in desktop app#7
Draft
Copilot wants to merge 2 commits into
Draft
Conversation
Agent-Logs-Url: https://github.com/Genuifx/claude-code-env-manager/sessions/2a324f2b-54ab-4403-96fe-8888fa95aa7f Co-authored-by: Genuifx <10156994+Genuifx@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Genuifx/claude-code-env-manager/sessions/2a324f2b-54ab-4403-96fe-8888fa95aa7f Co-authored-by: Genuifx <10156994+Genuifx@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
Genuifx
May 20, 2026 14:28
View session
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.
Follow-up to the perf-log instrumentation: a static walk of
apps/desktop/to actually name the bottlenecks, with file:line citations. No code changes in this PR — review the findings, then I'll open targeted fixes.P0 — "the longer it runs, the slower it gets"
App.tsx:593-604togglesdisplay:noneinstead of unmounting, so every Workspace effect keeps running on Settings/History/Analytics tabs.RuntimeOverviewCardpolls 3 IPCs every 7s with noisActivegate.components/workspace/RuntimeOverviewCard.tsx:111-113. Only checksdocument.visibilityState.components/workspace/WorkspaceMessageBubble.tsx:845—setInterval(() => setNow(Date.now()), 1000)on every streaming bubble, regardless of tab/visibility.InteractiveToolEventsPanel:193,HeadlessSessionsPanel:198,useWorkspaceSessionDecorations.ts:467,pages/Sessions.tsx:260,RuntimeOverviewCard.tsx:111. Most duplicate already-wiredlisten()event streams.P1 — long-conversation jank
MarkdownRendereris not memoized and passes an inlinecomponents={{...}}toreact-markdown.components/history/MarkdownRenderer.tsx:313-326. New object identity every parent render → full markdown subtree (incl. Prism) re-renders for every visible bubble. Single biggest contributor to scroll/segment-switch jank.components/history/HistoryDetail.tsx:79-103—renderedMessageCountincrements via IntersectionObserver but older messages never unmount. No virtualization library inpackage.json.pages/ProxyDebug.tsx:118-122—[payload, ...prev.filter(i => i.id !== payload.id)].slice(0, 200)runs O(n) on everyproxy-trafficevent.P2
useAppStorecall sites missingshallow— notably high-churnHeadlessSessionsPanelandWorkspaceNativeSessionView(×2). AlsoBindToChatDialog,AiCronPanel,PetEntry,BindToTelegramDialog,SessionsCard.App.tsx:401-460firesloadCurrentEnv+loadEnvironments(+loadSessions) on every refocus despiteenv-changed/perm-changedevent coverage.P3
backdrop-filtersurface area — already mitigated byperformanceMode='reduced', not the primary issue.Suggested fix sequence
isActivegate onRuntimeOverviewCard+memo(MarkdownRenderer)withcomponentshoisted to module scope + addshallowto the 7 sites.usePoll(fn, ms, { active, visibilityGated, idle }); gate the per-bubble 1s timer onstreaming && visible; ProxyDebug →Map<id, item>+useDeferredValue.@tanstack/react-virtualfor History once re-render storms are gone; add Rust-side tracing on the high-frequency commands surfaced by perf-log.Want me to proceed with step 1?