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.
This PR adds brnach-listings using
gix, but without branch details, to increase performance or at least make for more maintainable code.Tasks
criteriongit2performancegixFollow Ups
check --all-targetsassurebenchesdo not rot #4651figure out how to buildmax-performanceon CI - needscmakewhich isn't installed - relevant for object database performance later.gix#4652gitoxidegixfor branch normalization #4665Performance
When switching from
git2togitxwe see thatgit2can be 7,5% faster on MacOS when traversing refs. But we also see that handling many tracked branches is super slow (20x to 200x!), and when dealing with tiny repositories,gixalso is much faster as forgit2the time to open the repository dominates.More testing showed that it's all about
core.precomposeUnicode, which consumes a lot of power ingixand which seems to be ignored bygit2. When turned off,gixis the clear winner - a win which didn't come easily by the way.Note that the picture above was done with
max-performance, something that I had to remove as it didn't work on CI just yet.Git2 Performance Notes
git2based run, one thing stuck out: In a repo with 300 tracked branches, getting the remote name is very slownormalize_branch_name- this will be faster when implemented ingitoxideas it won't useregexsubstitution, but edits in-line.Gix Performance Notes
When listing branches,
gixisn't naturally faster. Major consumers overall are…git2is also eagerly loading though, so I guess it's OK to hope for packed refs to be present if there are too many refs.Comparison
This is the
criteronoutput (with the profiler attached) running thegit2after having recorded thegixversion.It's notable that some tests are from 4x to 20x faster in
git2initially.It turned out all the time was spent reading and re-reading the same commit object, as object caches aren't enabled by default. The second factor was rechecking for packed-refs freshness too often - now it's done once for the operation.
Here is the 20x run in isolation and with instrumentation, coming from
git2and going togix.After adding an object cache and reusing packed refs buffers it's much better, but still up to 10% slower in some cases. Let's see if the performance of 20x in the bad
git2case gets worse for us when remote names can be extracted from local tracking branches.Finally, a run going from
gixtogit2but withcore.precomposeUnicodeenabled.gixlooses quite a bit of performance then.