Repository navigation
perf(web-ui): speed up BTW switching, Settings startup, and Canvas tabs - #3910
Merged
Merged
Conversation
Cache BTW projections by their source turn array so reopening a panel reuses the rendered items while evicted snapshots can be collected. Keep streaming prefix caches scoped to the mounted panel.
Defer indexing until the first nonblank search to remove translation work from settings startup. Reuse the index across searches and refresh it when the active language or relevant translation resources change.
Keep hidden Editor and Diff panels at their layout size to avoid Monaco relayouts on tab switches. Make inactive panels inert and cover pane reuse and activation in the canvas tests.
Closed
3 tasks done
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
Refs #3806
Type and Areas
Type: Performance, bug fix
Areas: Web UI, FlowChat / BTW, Settings, Canvas / Monaco
Motivation / Impact
These changes address three workflows identified in #3806: returning to a BTW transcript, opening Settings, and switching among cached Canvas tabs. Ordinary settings page changes already reuse the search index. Deferring the first build removes translation work from Settings startup and allows search to pick up terms from newly loaded resources.
Verification
270 focused Vitest tests passed across 15 files. Run from
src/web-ui:node scripts/run-vitest.mjs run --maxWorkers=6 \ src/flow_chat/store/modernFlowChatStore.test.ts \ src/flow_chat/components/btw/{btwTailFollow.test.ts,useBtwSessionState.test.tsx,useBtwPanelViewport.test.tsx,BtwVirtualSessionList.test.tsx,BtwSessionPanel.review-action.test.tsx,BtwSessionPanelLayout.test.ts} \ src/app/scenes/settings/{SettingsNav.test.tsx,SettingsScene.test.tsx,settingsRegistry.test.ts} \ src/app/components/panels/content-canvas/{editor-area/EditorArea.test.tsx,CanvasToolbar.test.tsx,tab-bar/TabBar.test.tsx} \ src/tools/editor/{services/editorViewResidency.test.ts,components/CodeEditor.test.tsx}pnpm --dir src/web-ui exec tsc --noEmit,pnpm run i18n:audit, andpnpm run theme:color-audit:allpassed.pnpm run check:webstopped at the existing typography audit violation inDialog.module.css:77(--openbitfun-line-height-snug), which is also present on the base branch.BTW: in a synthetic 80-round hot-remount benchmark, projection P95 fell from 1.15 ms to 0.004 ms. A local garbage-collection probe also confirmed that releasing the source turn array allows the cached projection to be collected.
Settings: in a six-pair local WebView2 prototype, first-open median was 264.3 ms with eager indexing and 186.9 ms with deferred indexing. This measures the whole navigation path. A separate smoke test of the implemented build found the late-loaded editor search phrase in all three runs.
Canvas: in a local Windows WebView2 comparison against forcing cached editors to use
display: none, each condition had 42 hot switches per tab count. P95 to the next RAF after the pane became visible fell from 128.9 to 66.5 ms with 3 tabs and from 166.0 to 83.0 ms with 20 tabs. An additional 15 switches per condition recorded 30 versus 0 Monaco layout callbacks. Verified that hidden editors cannot take focus or intercept hit tests and that switching back preserves scroll position.Reviewer Notes
AI-assisted. Focused tests and local manual verification are complete. The timings are local diagnostics; RAF measures frame opportunities. Remote Workspace, Remote Control, Peer Device Mode, and Detached Dispatch were not exercised.
Checklist