Repository navigation
perf(gui): coalesce diff refresh after staging - #49
Open
HiFiveJazz wants to merge 1 commit into
Open
HiFiveJazz wants to merge 1 commit into
HiFiveJazz wants to merge 1 commit into
Conversation
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
This PR avoids eagerly refreshing the diff immediately after optimistic stage/unstage updates.
The existing stage/unstage flow already does a pretty good job of doing status-only refresh after the background Git operation completes, and that refresh schedules a diff update using authoritative repository state. However, setting
needs_diff_refreshbefore the Git operation completes causes the same mutable diff to be generated twice, which is unnecessaryThis removes those three eager diff invalidations for:
The optimistic file-status update remains unchanged, so staging still updates the file list immediately.
Performance
Measured with
strace -f -e trace=execve, with auto-refresh and auto-fetch disabled.Stage-all + unstage-all:
Single-file stage + unstage:
The removed subprocesses are the redundant diff previews issued before the authoritative status refresh. The later diff refresh after git status --porcelain -uall remains. I tested this using
cargo testand saw no regressions.