Skip to content

perf(editor): build the query tab in AppKit and read the sidebar listing when the filter takes focus - #3834

Merged
datlechin merged 2 commits into
mainfrom
perf/query-tab-first-build
Oct 25, 2026
Merged

datlechin merged 2 commits into
mainfrom
perf/query-tab-first-build

Conversation

@datlechin

@datlechin datlechin commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Summary

  • The query tab is AppKit down to its panes: EditorAreaController (history drawer) and QueryTabSplitController (editor over results) under one representable, EditorAreaHost, in MainEditorContentView. SwiftUI stays in the leaves: the command bar, the results, history and the other tab kinds.
  • SQLEditorController replaces SQLEditorView and hosts the editor through TableProEditorKit's new SourceEditorHost, which reuses SourceEditor's coordinator, text and state sync and dismantle without a SwiftUI host around the editor.
  • Why: each platform view SwiftUI inserts makes AppKit recalculate the key view loop, which lays out the window. With three SwiftUI hosting views nested above the editor, the tab content host was laid out more than ten times, nested, in the turn that builds a restored query tab.
  • VerticalCollapsibleSplitView, QueryEditorView and SQLEditorView are removed. CollapsibleSplitController keeps their collapse sync, autosave order and minimums.
  • An edit reports its caret before its text is written back, so the caret now waits for the text before it reaches the tab.
  • The sidebar filter asks for the all-schema listing when it takes focus on the Tables scope, not on the first character. A search asks once whether it starts at focus or at its first character.
  • The outline no longer rebuilds when a listing goes from not read to loading, which draws nothing new.

Measured on a Release build, main and this branch interleaved, machine load 12 to 14:

  • Opening a two-table PostgreSQL connection on a saved query tab: the worst main-thread stall in the step went from a median of 196 ms to 128 ms (6 runs each).
  • Oracle, 100 schemas of 500 tables, first sidebar-filter keystroke 0.3 s after focusing the filter: from a median of 640 ms (573 to 2,049) to 212 ms (195 to 529), 5 runs each.
  • Screenshots of the query tab from both builds are byte-identical with nothing typed; with a query run they differ only by the caret blink and the timing.
Before After
Light Before, light After, light
Dark Before, dark After, dark

Test plan

  • New: SourceEditorHostTests (sync both ways; a caret write does not swallow the next text; dismantle), EditorAreaControllerTests (another tab kind takes the editor down, a query tab switch keeps it; user collapse written back), SQLEditorCursorPropagationTests.editCaretReachesTheBinding, SidebarSchemaFilterTests (focus reads the listing once; Favorites reads none; a failed focus listing is not read again by the first keystroke), SidebarContainerChromeTests focus flag, DatabaseTreeReconcileTests idle and loading render the same.
  • Changed on purpose: QueryEditorViewLayoutTests became QueryEditorPaneLayoutTests; SQLEditorCursorPropagationTests hosts SQLEditorController.
  • Local: 400 tests across the 49 suites that touch the changed types, all pass; lint clean.

Refs #3661

@datlechin
datlechin enabled auto-merge (squash) October 25, 2026 13:06
@datlechin
datlechin merged commit 79cdb07 into main Oct 25, 2026
9 checks passed
@datlechin
datlechin deleted the perf/query-tab-first-build branch October 25, 2026 14:32
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