WIP: allow use of modification times to speed up equals function in merkletrie diff #1694
Closed
hansbogert wants to merge 2 commits intogo-git:mainfrom
Closed
WIP: allow use of modification times to speed up equals function in merkletrie diff #1694hansbogert wants to merge 2 commits intogo-git:mainfrom
hansbogert wants to merge 2 commits intogo-git:mainfrom
Conversation
77b4abe to
9846196
Compare
bd8bf64 to
e68c527
Compare
Otherwise if the environment has global git hooks, which is not uncommon on developer machines, this could fail unnecessarily.
Author
|
@pjbgf Can this workflow be started? 👼 |
Member
|
@hansbogert thanks for looking into this. Status indeed has some room for improvement in terms of performance. At present, I'm not sure how aligned this is with upstream, I'd need to take a proper look at that. If this diverges from upstream, it would need to be an opt-in feature as opposed to changing the default behaviour. |
Author
|
Yeah please let me know in time. If this is a wanted optimization i can look into the windows flakyness. My first bet is lower time resolution, like milliseconds, maybe you know more? |
Author
|
No longer needed thanks to #1747 |
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.
For my application i rely heavily on the speed of git status, I noticed that go-git does not use modification times where upstream git would do so for a git status. I noticed a large performance discrepancy between the mentioned application using -go-git, and a roughly 30 line bash script using upstream
gitwhich should be doing the functional equivalent.Depending on the size of the files in a worktree, the use of modtimes instead of rehashing everything results in substantial time savings.
The existing benchmark for git status, with a rather trivial size for a repo, already shows a ~6x performance increase. I expect this performance increase to be larger with larger repo's.
With this change applied:
Basically this change first checks if modification time is the same between the index and the worktree, if not proceed as usual by rehashing, if the same, mark as equal.
This could well be very naive and some expert review is needed. Note that this 'fasthpath' would become the default when doing a
worktree.Status(). Another option would be to introduce anOptionforStatus(...).