Files
orca/src/renderer
NeilandOrca bb8b1c3859 perf(renderer): index tab lookup in hook-completion prune (O(C*T) -> O(T)) (#7496)
The agent hook-completion notification subscriber runs
syncAgentHookCompletionNotificationSettings() -> pruneClosedPaneCoordinators()
on every store notify — which includes every OSC title/spinner frame, since
tabsByWorktree reallocates on each. The prune looped every coordinator and, for
each, re-flattened Object.values(tabsByWorktree).flat().find(...) to resolve its
tab, i.e. O(coordinators x total-tabs) of array allocation + scan per notify.
Unlike the sibling mobile-sync path, it had no gate.

Build the paneKey->tab index once per prune pass and thread it through
paneCanReceiveHookCompletion / paneKeyHasUnsuppressedPtyHint (single-call sites
keep the direct lookup). First-wins index matches the previous flat().find()
semantics exactly. Also skip the pass entirely when no coordinators are tracked
(the common idle case).

Tests: selective prune across many coordinators still evicts only the panes
that lost liveness, and tabsByWorktree is read exactly once per prune pass
regardless of coordinator count (pre-fix: once per coordinator).

Co-authored-by: Orca <help@stably.ai>
2026-07-05 23:08:31 -07:00
..
2026-03-17 01:40:24 -07:00
2026-05-30 13:09:17 -07:00