Repository navigation
perf(idle): save tabs only after a change and let the app nap with a tunnel open - #4597
Merged
Merged
Conversation
…tunnel open Each window ran its own 30-second loop that rebuilt, encoded and hashed every tab only to find nothing changed. A persistence generation now moves on every write a tab save reads, drives the existing debounced save, and lets a save return before building anything when it did not move. The SOCKS, Cloudflare, Cloud SQL and tunnel command managers no longer hold an App Nap activity for the life of a tunnel.
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
QueryTabManager.persistenceGenerationmoves on every write a tab save reads: the tabs setter, the selection, the editor's fast text path, the caret (cursorPositions) and the grid selection (QueryTabGridStateStore.selectionSnapshot). Each move drives the existing 1 s debounced save, which replaces the per-window 30 s loop.TabPersistenceCoordinator.saveAggregatedIfChanged()compares a fingerprint (every hosting window's generation plus the browsed database and schema) with the one the last save went out with, and returns beforeaggregatedTabs,toPersistedTab, the JSON encode, the hash and the file checks. Quit, window close and disconnect keep their synchronous saves, which always run.beginActivity(.userInitiatedAllowingIdleSystemSleep)for the life of a tunnel. The last three relay in a child process; the SOCKS relay runs onNWConnectionreceive callbacks, and socket readiness wakes a napped process, which is what perf(ssh): relay each session's channels from one event-driven reader and drop the App Nap hold #4248 measured for SSH.Test plan
TabPersistenceGenerationTests(new): each saved input, written through its normal path, moves the generation, a same-value write does not, and each write reaches the owner's change-driven save.powermetricsidle wakeups and the napped relay latency need a live SOCKS and Cloudflare tunnel; listed on perf(idle): save tabs only after a change and let the app nap with a tunnel open #4558.Closes #4558