Skip to content

perf(interface): optimize main-btw alternation, canvas tab switch, and settings traversal - #3806

Open
Raing5Days wants to merge 1 commit into
GCWing:mainfrom
Raing5Days:perf/interface-switch-opt
Open

Raing5Days wants to merge 1 commit into
GCWing:mainfrom
Raing5Days:perf/interface-switch-opt

Conversation

@Raing5Days

Copy link
Copy Markdown
Contributor

Summary

This PR addresses interface switching latencies across three key UI interaction flows:

  1. Main-BTW Session Alternation (\OpCase-BTW-01):

    • Problem: When alternating focus between an 80-round parent session and a BTW child session, \BtwSessionPanelContent\ previously re-instantiated \projectSession\ via local \useState(createSessionVirtualItemProjector)\ upon pane re-activation, discarding accumulated turn prefix caches.
    • Solution: Retain the warm \projectSession\ projector inside the persistent tab-owned \BtwPanelViewState\ across remounts, providing sub-millisecond warm reuse during parent-child context switching.
  2. Canvas Cached Tabs Hot Switch (\OpCase-Tab-01):

    • Problem: In \EditorGroup, \ absToRender\ read from \cachedTabsRef.current\ directly inside \useMemo\ without explicit dependency decoupling, risking redundant computation during hot switching between Terminal, Diff, and Editor tabs.
    • Solution: Extract stable \cachedTabs\ reference and pass it directly to \ absToRender\ memoization dependencies to guarantee constant-time display toggling.
  3. Standard Settings Traversal (\OpCase-Settings-01):

    • Problem: In \SettingsNav, navigating between settings pages repeatedly re-executed the flat search index compilation \�uildSettingsSearchIndex, re-translating and recreating 80+ destination objects on route changes.
    • Solution: Memoize compiled search index rows via \WeakMap<I18nApi, SettingsSearchRow[]>\ keyed by the i18n instance.

Verification


  • ode .perf-harness/perf-agent-runner.mjs --case OpCase-BTW-01: Passed (P95: 9.40ms, Max: 9.40ms <= 50ms budget)

  • ode .perf-harness/perf-agent-runner.mjs --case OpCase-Tab-01: Passed (P95: 0.04ms, Max: 0.04ms <= 33.3ms budget)

  • ode .perf-harness/perf-agent-runner.mjs --case OpCase-Settings-01: Passed (P95: 0.004ms, Max: 0.004ms <= 45ms budget)
  • Unit tests:
    • \src/flow_chat/components/btw/BtwSessionPanel.review-action.test.tsx\ (41 passed)
    • \src/app/scenes/settings/SettingsScene.test.tsx\ (9 passed)
    • \src/app/scenes/settings/SettingsNav.test.tsx\ (11 passed)
    • \src/app/components/panels/content-canvas/ContentCanvas.test.tsx\ (5 passed)
  • Boundary & Hygiene checks:
    • \pnpm run check:repo-hygiene\ passed
    • \pnpm run check:core-boundaries\ passed

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.

1 participant