Repository navigation
Backlog
Labels
enhancementNew feature or requestplatform-macosAbout the macOS apprustPull requests that update rust code
Description
Plan from a measured pass over the macOS app, the Rust core and the drivers: Instruments traces, heap and footprint readings, server statement logs, and a code review where each finding was checked a second time. Every item fixes the cause the measurement or the code path shows. No special cases and no caps that hide a cost.
Where the time and memory go
- Results are rows of enums: a 24-byte value per cell, a heap string per text over 15 bytes, a heap array per row. 1M x 20 is 1.26 GB on PostgreSQL and 856 MB on MySQL.
- The UI around the data costs more than the data. Opening a table spends about 167 ms of main-thread CPU, 75% of it SwiftUI; the driver fetch is 5 to 15 ms. Typing spends about 12.7 ms of main-thread CPU per key.
- Connecting opens 3 PostgreSQL connections and sends about 19 statements to open one table, with the table, database and schema lists each read twice.
- Drivers convert values several times, and nothing bounds memory across a long session.
Decisions
- The result data path moves onto the core now: one columnar store for macOS, Windows and Linux. This changes the order in ADR 0010, which gets an amendment first.
- The macOS 13 floor stays. Per-tab invalidation is built by hand with
ObservableObject. - No app-imposed row limit. The row limit stays a user setting, and the 5,000,000-row emergency cap goes once the store lands.
Result data path
- perf(memory): build each result row at its exact size in every driver #4520
- perf(results): hold every Mac result in the core's columnar store #4521
- perf(core): decode results straight into typed columns the store keeps #4522
- perf(results): let a plugin write column bytes straight into the result store #4523
- perf(results): stream fetch all into the store and keep the truncated flag #4524
- perf(results): read large text, json and blob cells as a head and a length #4525
- perf(grid): page table tabs by seeking on the key instead of offset #4526
- perf(results): free a replaced or closed result off the main thread #4527
Main thread and view architecture
- perf(tabs): opening a table spends 167 ms of main-thread CPU, most of it in SwiftUI #4528
- perf(tabs): one tab change invalidates the views of every tab in the window #4529
- perf(results): driver calls and the work after each await run on the main actor #4530
- perf(grid): copy, type-select and format changes walk every row on the main thread #4531
- perf(sidebar): filtering a 100,000-table catalog runs on the main thread on every key #4532
SQL editor
- perf(editor): stop copying the whole document on every keystroke and caret move #4533
- perf(editor): keep statement boundaries in an index that edits update #4534
- perf(editor): parse edits off the main thread without copying the document #4535
- perf(editor): redraw only the changed lines on a caret move or edit #4536
- perf(editor): emphasis layers and find search left from #4428 #4436 (covered by perf(editor): emphasis layers and find search left from #4428 #4436, details added there)
- perf(editor): keep each query tab's document when switching tabs #4537
- perf(editor): bound the memory each document's undo history holds #4538
Autocomplete
- perf(autocomplete): run completion analysis off the main thread and drop the 50 ms wait #4539
- perf(autocomplete): rank table names from a prebuilt index instead of sorting the catalog #4540
- perf(autocomplete): size the completion popup before showing it and update rows in place #4541
Connecting and round trips
- perf(connections): use the idle session for the first listing and read each list once #4542
- perf(connections): read the catalog side kinds in one round trip per engine #4543
- perf(connections): send session setup with the connect instead of in extra round trips #4544
- perf(ssh): drop the probe channel, share a session per bastion, keep libssh2 off the pool #4545
- perf(connections): reconnect when the network returns and ping less while inactive #4546
Drivers
- perf(postgresql): read rows in libpq chunks instead of one result per row #4547
- perf(mongodb): decode BSON once and stop the extra reads on every page #4548
- perf(redis): page keys with a saved scan cursor and overlap the pipelines #4549
- perf(drivers): decode ClickHouse and SQL Server cells without per-field copies #4550
- perf(sqlite): run SQLite statements on their own thread, not Swift's shared pool #4551
Import and export
- perf(export): start an export without an exact count of every table first #4552
- perf(export): stream gzip while writing a dump and while reading one back #4553
- perf(import): bulk-load rows with COPY and LOAD DATA, and batch when skipping errors #4554
- perf(import): lex imported SQL once and read a dump's table DDL per schema #4555
Long sessions
- perf(memory): one app-wide budget for results held off screen #4556
- perf(memory): find why footprint stays high after a large result is closed #4557
- perf(idle): save tabs only after a change and let the app nap with a tunnel open #4558
Related open items from the earlier audit: #4436 #4437 #4438 #4439 #4442 #4444 #4453 #4454 #4459 #4462 #4464.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestplatform-macosAbout the macOS apprustPull requests that update rust code
Activity