Repository navigation
Answer an attached viewer's unchanged listing without resending it - #888
Merged
Merged
Conversation
An attached viewer asks for the full listing five times a second, even hidden, and a full listing is every patch base64'd twice by the owner, inside its gate, then parsed again by the viewer - to learn, almost every time, that nothing changed. The owner now tags each full listing, and the viewer sends back the tag of the one it holds. While the tag still stands the owner answers "unchanged" and nothing else, and the viewer keeps the queue it already parsed; the tracked files are still stat'd each pass, since a re-run rewriting one changes no listing. The tag is taken before the listing is built, so a change landing in between costs one more full listing rather than a stale one kept. A tag is cheap to take: both queues are immutable, so a new reference is a new generation. The tray also folds in its tracked files, which its own scan changes, and a count of stashed window commands, so a focus is never answered unchanged. Each owner's tags carry an id of their own, so a tag held across an owner restart cannot match. A hidden window lists once a second instead of five times. Older owners ignore the tag and answer in full; older viewers send none and are answered in full.
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.
From the review's perf list: an attached viewer asks for the full listing five times a second, even while hidden. Each one is every patch base64'd twice by the owner, inside its gate, and parsed again by the viewer, almost always to learn that nothing changed.
The change
ViewerResponse.Tag), and the viewer sends back the tag of the one it holds as theListFullbody.unchangedand sends nothing else. The viewer keeps the queue it already parsed. It still checks the tracked files each pass, since a re-run rewriting one changes no listing.OwnerLink.HiddenInterval).Tests
ViewerProtocolTests.AnUnchangedListingIsNotSentAgaincovers the wire format: a matching tag, a changed tag, an untagged owner, and a reader that sends no tag.AttachedViewerTests, against a real owning viewer over a socket:AnUnchangedQueueIsNotSentAgain;AnAttachedViewerFollowsAChangeAfterAnUnchangedListing;ARefusalArrivesOnAnUnchangedListing: a send's message still reaches the window when the listing is unchanged.TrayViewerSyncTest.ATrackedFileOrAStashedFocusIsNeverAnsweredUnchangeduses the real tray.IpcTestssnapshots gainUnchanged: false.The full solution passes locally in Release: 2,046 passed, 24 skipped.