Skip to content

perf(welcome): own the toolbar and search in AppKit - #4415

Merged
datlechin merged 6 commits into
mainfrom
perf/welcome-appkit-toolbar
Nov 23, 2026
Merged

datlechin merged 6 commits into
mainfrom
perf/welcome-appkit-toolbar

Conversation

@datlechin

@datlechin datlechin commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Summary

  • The Welcome window controller owns an AppKit NSToolbar: New Connection and New Group (NSToolbarItem), View Options (NSMenuToolbarItem, built when it opens) and Search (NSSearchToolbarItem), in the places SwiftUI put them.
  • The list pane drops .searchable, .toolbar and sceneBridgingOptions. Panes, rows, sheets and alerts stay SwiftUI.
  • Active tag filters show in a bar above the list: one toggle per tag (click removes it), Any/All when two or more are on, Clear Filters. NSSplitViewItemAccessoryViewController on macOS 26 and later, a bar at the top of the list pane with a separator before 26. Built when the first tag turns on.
  • Tag suggestions while typing on macOS 15 and later (NSTextSuggestionsDelegate); choosing one filters by the tag and clears the text. In today's Release build on macOS 27.0.1, typing a tag name suggests nothing. On 13 and 14 tags come from View Options. Tokens inside the field are gone: AppKit has no public API for them.
  • The View Options glyph fills while a tag filter is on. Its menu lists Sort By, Filter by Tag and Match as inline sections (Sort By was a submenu).
  • macOS 13 gets the toolbar and search: sceneBridgingOptions is 14+, so the bridged items never reached the window there.
  • WelcomeViewModel.searchTokens ([WelcomeTagToken]) becomes tagFilterIds: [UUID] plus a published tagFilter that the bar and the glyph render.
  • Tests changed on purpose: WelcomeToolbarTests is rewritten (the WelcomeWindow subclass that re-fixed a SwiftUI-installed toolbar is gone, and its two tests with it); WelcomeViewModelTests follows the rename, and testDeletingTheLastTaggedConnectionDropsItsTokenFromTheSearch is now testDeletingTheLastTaggedConnectionDropsItsTagFilter.
  • UI tests find toolbar items by label. CI's element tree shows what AppKit publishes: Button New Connection, Button New Group, MenuButton View Options, none with an identifier; the search field keeps welcome-toolbar-search. A tag toggle in the bar is a CheckBox. ConnectionSeed takes preset tag ids.

Measurements

  • Release, arm64. Before: the perf-audit build of main at 9d0d481 (before build(release): ship per-arch builds and a per-arch appcast #4414, which does not touch launch). After: this branch at 193bf28, apple/scripts/release/build.sh app arm64 --unsigned.
  • Ad hoc copies, each launch in its own TABLEPRO_UI_TEST_SANDBOX seeded with 50 connections in groups with tags. Interleaved, random order per round, one discarded warm-up each, n=10 per side, load1 4.3 to 6.7. LaunchTracer (TABLEPRO_LAUNCH_TRACE=1) for stages; main-thread and process CPU read at the firstFramePresented mark.
metric, median (p90) before after change
main-thread CPU, exec to first frame 417.7 ms (460.6) 374.9 ms (380.5) -42.8 ms, -10%
process CPU, exec to first frame 650.5 ms (711.7) 592.8 ms (606.1) -57.7 ms, -9%
instructions to first frame 8,741 M 7,842 M -898 M, -10%
phys_footprint at first frame 66.6 MB 62.6 MB -4.0 MB
Welcome window: intentsRouted to firstFramePresented 303.8 ms (314.5) 253.7 ms (281.5) -50.1 ms, -16%
intentsRouted to firstWindowOrdered 267.9 ms 230.1 ms -37.8 ms
firstWindowOrdered to firstFramePresented 36.7 ms 25.7 ms -11.0 ms
LaunchTracer stage, median ms since exec before after
main 20.1 19.7
applicationCreated 158.4 222.3
menuInstalled 206.2 270.1
pluginsDiscovered 215.2 279.2
didFinishLaunchingEnded 245.3 310.8
intentsRouted 250.1 316.9
firstWindowOrdered 518.5 547.7
firstFramePresented 557.0 568.3
  • Exec to first frame comes out +11 ms because applicationCreated (NSApplication.shared, before any code this PR touches) is +64 ms in this run. With the copy order swapped (load 22 to 35, n=5) that gap shrank to 21 ms while the new build still used less main-thread CPU and 1.15 billion fewer instructions; an arm64-thinned copy of the old build (load 30 to 48, n=10) gave -42 ms main-thread CPU. The window build and CPU numbers are this change; the early gap is launch environment.
  • The prototype estimated -99 ms main-thread CPU for this step; the real app saves 43 ms.
Per run, load1 at launch
run variant load1 main-thread CPU ms firstFramePresented ms
1 before 5.26 416.0 546.7
1 after 5.32 373.4 557.6
2 before 5.32 427.9 562.4
2 after 4.97 380.0 565.8
3 before 4.97 414.0 557.8
3 after 4.73 380.5 590.4
4 before 4.73 416.1 543.1
4 after 4.73 376.4 603.8
5 before 4.67 460.6 872.8
5 after 4.67 379.0 578.6
6 before 4.54 413.4 526.7
6 after 4.54 366.8 543.1
7 before 4.34 416.8 538.3
7 after 4.34 372.9 570.8
8 before 4.34 429.9 574.5
8 after 4.95 368.8 551.3
9 before 4.95 418.6 556.3
9 after 4.63 372.9 560.5
10 before 6.74 553.7 1468.9
10 after 4.63 424.8 1072.9

Screenshots

Two tag filters on (production, testing). Before: tokens in the search field, set from View Options. After: the bar above the list, set by typing each tag and picking its suggestion.

Light Dark
Before Before, light Before, dark
After After, light After, dark

Test plan

  • WelcomeToolbarTests, WelcomeTagSuggestionsTests, WelcomeTagFilterBarTests: toolbar order, labels and Icon Only; View Options sort, tags, Match, Clear Filters and the filled glyph; search field and query in step; Return focuses the list; suggestions on 15+; the bar's toggles, Any/All, Clear Filters, and the bar coming and going on the split item.
  • WelcomeConnectionListUITests.testTheToolbarFiltersByTagAndSearchesTheList: View Options by label, a tag filter shows the bar and hides untagged rows, clicking the tag removes it, Cmd-F into the toolbar search, typing narrows, Return selects the first match.
  • CI green on 193bf28: build, strings catalog, Unit plan, UI plan.
  • Codex adversarial review and review against main: no findings.
  • Release build checked by hand on macOS 27.0.1: suggestions pick a tag, the bar and glyph follow, light and dark.

@datlechin
datlechin marked this pull request as ready for review November 23, 2026 01:43
@datlechin
datlechin enabled auto-merge (squash) November 23, 2026 01:43
@datlechin
datlechin merged commit 120f6fe into main Nov 23, 2026
12 checks 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