Repository navigation
perf(storage): stop idle and repeated writes, and the caret timer with no drawn caret - #4435
Merged
Merged
Conversation
Caret timer only for a drawn caret, no table load history file, unchanged last session and tab state left alone, tip donations only while counted, a slimmer query history schema, two dashboard statements a refresh off the user's session, and view state removed with the connection that wrote it.
…ail the metrics panel when the server answered nothing
datlechin
marked this pull request as ready for review
November 23, 2026 10:57
…f the session turn on server scope
… main Codex kept finding new defects in the review fixes (transaction revision on server scope, pooled Cancel queued behind pool work, size cache identity). WI9 and WI10 move to the follow-up.
…s after a failed connect
datlechin
enabled auto-merge (squash)
November 23, 2026 13:43
# Conflicts: # apple/TablePro/Core/Storage/ConnectionLocalState.swift
This was referenced Nov 23, 2026
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
Perf audit 2026-11-22, findings 19 and 20 (writes-idle lane).
CursorTimerruns only while a drawn caret is registered. From macOS 14 the caret isNSTextInsertionIndicator, which blinks itself, so the timer fired twice a second for nothing, also behind a Server Dashboard tab.TableLoadHistoryStoreis gone. At its cap it rewrote 4.8 MB per table load.TABLEPRO_TABLE_LOAD_TRACE=1prints onetableload <json>line per load to stderr, whichapple/scripts/benchmark/app-paths/benchmark.pyreads. The file older builds kept is removed after launch.NSString: edited text is the editor'sNSTextStoragestring, bridged with no contiguous UTF-8, and a walk of itsutf8view cost about 100 ms per 2 MB on every tick. Sleep tolerance 10 s.LastSession.jsonandLastOpenConnections.jsonare left alone when the session is unchanged and both files exist. They were rewritten on every app switch.fingerprint_hashindexes nothing reads are dropped;user_versionis written only when it differs;history_ftsis rebuilt once withcolumnsize=0and no prefix indexes, in one transaction, keeping the old index if the rebuild fails.TransientConnectionLedger, and their view state is purged after launch once no session and no window can reach them.Before and after
Mac mini (12 cores), Release arm64. Before: origin/main 9d0d481. After: this branch at 61a9e50, before the dashboard cut and the WI6 fix, neither of which any row below exercises. cpu-idle
--quick(60 s window), 3 before and 2 after runs in the order B B A A B; disk-iosession(20 pages, 15 query runs, 10 app switches) andseeded(table load history and column layouts at their caps), one run each. Load is load1 at the start; the Mac was shared, load 3 to 530.save-large-bg(41 tabs, 10 MB of SQL), M instructions/minsave-small-bg(reference: 41 short tabs), M instructions/minutf8walk, load 258)query-fginterrupt wakeups/sTests changed on purpose
TableLoadHistoryStoreTestsdeleted with the store.TableLoadPerformanceRecordTests: the two stored-format tests (older line decodes, previous stable reads this line) replaced by a mapping test.TableLoadTracerSinkTests: the shared-tracer history file test replaced by no-sink, stderr line and retired file tests.New:
CursorTimerTests(10),TabDiskUnchangedSaveTests(+7),LastOpenConnectionsStorageTests(+4),FeatureTipsTests(+4),QueryHistorySearchIndexTests(5),TransientConnectionLedgerTests(10).Deliberately not fixed here
String ==. WI10 needs a control connection Cancel and Terminate never share; WI9's kept size needs a byte-exact database key (CatalogName.same). With a dashboard open on this Mac: 86 PostgreSQL statements and 1,123 M instructions a minute before; the build with WI9 and WI10 read 27 statements and 909 M instructions.dashboard-fgprofile, after WI9.DatabaseManager+ScopedDriver.swift, which the connections lane changes.PluginStreamAbortandPluginRowSpill, after perf(export): MongoDB export documents, Parquet limits and unmeasured items left from #4434 #4444's M2 and EX5.Test plan
verify.sh test, 27 suites (the changed ones plus tab persistence, query history, table load trace and dashboard): 282 passed, 0 failed (TableProTests 260, TableProTextEngineTests 22).verify.sh linton the changed Swift files: 0 violations.NSTextStorage(string:).stringhas no contiguous UTF-8, ASCII or not, before and after a typed character;String(contentsOf:encoding:)and JSON-decoded queries do.Docs: TableProApp/docs#274.