Skip to content

perf(windows): load restored table tabs when shown, read row estimates first, share the editor device, stop the idle caret and drop unused Windows App SDK parts - #4232

Merged
datlechin merged 4 commits into
mainfrom
fix/perf-windows
Nov 12, 2026
Merged

datlechin merged 4 commits into
mainfrom
fix/perf-windows

Conversation

@datlechin

@datlechin datlechin commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Session restore: a table tab reads its first page the first time it shows (its first Loaded), not when the session restores it. A restored filter's bar and choices wait for that too. (WIN-01)
  • Row counts: before it counts, a table tab reads the engine's estimate through a new FFI call, table_row_estimate over Connection::table_estimate (the Linux pager's path). As on macOS: an exact count the engine keeps is the total; under 100,000 rows, or with no estimate, the server counts as before; from 100,000 on nothing is counted, the status says "of about N rows" (no total under a filter), and Count rows in the command bar runs the count. Last page, Go to page and All rows still need an exact count. (WIN-02)
  • SQL editor: every editor on a UI thread draws on one Direct3D and Direct2D device, as the grid does, replaced for all once lost. A hidden tab gives back its swap chain and keeps its layouts and brushes, so a tab switch makes one swap chain instead of a device, factories, swap chain and layout cache. (WIN-03)
  • Package: the app and its libraries reference Microsoft.WindowsAppSDK.WinUI instead of the metapackage, as the Windows App SDK 1.8 notes allow, and the app prunes the metapackage the Community Toolkit 8.2 still names (PrunePackageReference). AI, ML (ONNX Runtime, DirectML), Search, Widgets and DWriteCore no longer ship. ADR 0005 updated. (WIN-04)
  • Leak: the editor's UISettings.ColorValuesChanged, its blink timer's Tick and its window activation listener are held only while it is loaded, so a closed query tab's editor can be collected. (WIN-05)
  • Object filter: the catalog is sorted once, off the UI thread, and each keystroke scans it on the thread pool, stopping the scan it replaces; the order is the old one (a test pins it under en-US, vi-VN, de-DE and tr-TR). Schema folders are grouped off the UI thread too. (WIN-06)
  • Caret: it stops blinking after the system caret timeout (SPI_GETCARETTIMEOUT) with no input, shown, and is hidden with no timer while the window is inactive (InputActivationListener), as Win32 edit controls do. (WIN-07)
  • Result sets: a run's sets are found by index through dictionaries, and each keeps its place, instead of three list scans per event. (WIN-09)
Measure Before After
10 restored table tabs, one shown: page reads, column reads, COUNTs (App.Model test) 10, 10, 10 1, 1, 1
COUNT(*) per open of a table estimated at 2,000,000 rows 1 0
Editor: Direct3D devices made over 30 tab shows (Editor.Tests, Windows CI) 30 1 at most
Editor removed and disposed is collected (Editor.Tests, Windows CI) no yes
MSIX, x64 / Arm64 (release-windows.yml, unsigned) 84.9 / 83.8 MiB 60.1 / 59.6 MiB
Object filter, UI thread per keystroke, 20,000 objects, vi-VN / en-US (this Mac) 12-59 / 5-21 ms 0 ms (scan 4-13 ms on the thread pool)
Caret redraws per idle minute (CaretBlink tests, 530 ms blink, 5 s timeout) 113 10
Caret redraws per minute in an inactive window 113 0
10,000 result sets, 3 events each, UI thread (this Mac) 1,229 ms 6.2 ms

Behavior notes

  • A large table's tab shows "1-1,000 of about 2,000,000 rows" and Count rows, where it showed an exact total after a full scan.
  • The caret stops blinking after 5 seconds without input, and an inactive window shows no caret.
  • WIN-08 (the hidden tab window rebuilt when the connection changes) is not in this PR: TabView shows the window it is handed before its drag loop so that window can paint (TabView::OnDragStarted in microsoft-ui-xaml), so the spare's workspace has to exist before a drag and cannot wait for the connection.
  • WIN-09 keeps every result set of a run, as the macOS app does since PF-04.

Needs the maintainer

  • The 100,000-row count threshold is a constant here, macOS's default; macOS has it as a setting.
  • Kept: every result set of a run (WIN-09), and a full frame per caret blink in its first seconds (WIN-07, no caret visual yet).

Test plan

  • New: TableTabCountTests, CaretBlinkTests, tests/TablePro.Editor.Tests (WinUI, Windows only: editor collected after Dispose, one device and one swap chain per show, the blink stops after the timeout), ShowAsync cases in TableTabTests, the filter order theory in ObjectFoldersTests, RunResultsTests with 10,000 sets, a_tables_estimate_is_unknown_until_analyze_writes_its_statistics (FFI), AnEstimateIsNoneUntilAnalyzeWritesTheTablesStatistics (Interop).
  • This Mac: solution build, solution tests (560), FFI tests (185), clippy and rustfmt, bindings regenerated.
  • Editor.Tests before numbers: the same tests with probe counters on main's code, on a temporary branch (run 43169763413, x64 and Arm64): 30 devices over 30 shows, editor not collected. After: both runners pass. The app, its UI tests, DataGrid.Tests and Editor.Tests build and run only in the Windows jobs.
  • Package contents: a restore of the app lists only WinUI, Foundation, InteractiveExperiences, Base and WebView2 from the Windows App SDK; the MSIX numbers come from release-windows.yml runs 43164825446 (main) and 43169528630 (this branch), whose packages installed and started on Windows Server 2022 x64 and Windows 11 Arm64.

@datlechin
datlechin enabled auto-merge (squash) November 12, 2026 07:58
@datlechin
datlechin merged commit 3db4390 into main Nov 12, 2026
35 of 36 checks passed
@datlechin
datlechin deleted the fix/perf-windows branch November 12, 2026 15:23
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