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 is a PoC, mainly intended to explore two things:
git2
forgix
for a single use case,Findings
This version uses
repo.rev_walk()
. We could also try implementing the existing algorithm usinggitx
primitives, but I think it makes sense to optimizerepo.rev_walk()
so that every consumer benefits from improvements.It seems as if using
gix
instead ofgit2
is fairly straightforward. There are a few changes necessary, but none of them major. Also, it seems as if the changes can mostly be contained inLogWalker
, in particular without the need to changeLogWalker::read
’s API. (LogWalker::new
needs to slightly be changed, but this does not look like an issue.)Performance-wise, it seems as if the
gix
implementation is slower than thegit2
implementation by about 30 %. I tested how long it took to open the app in my copy of the Linux kernel until the loading indicator stopped spinning, indicating that the full list of commit ids had been loaded. My copy of the Linux kernel contains 1_014_089 commits.gix
withuse_commit_graph(true)
: about 22 sgix
withuse_commit_graph(false)
: about 22 sgit2
(at commit 038c4a5): about 17 sKeep in mind that these are very rough numbers. It’s also possible that the
gix
API can be used in a way that is faster.gix
withfeatures = ["max-performance"]
When using
features = ["max-performance"]
,gix
is about 25 % faster on my machine than the implementation based ongit2
.gix
withuse_commit_graph(false)
: about 13 sgix
withuse_commit_graph(true)
: about 13 sgit2
without hash verification or cachingI added the following lines to
repo
inasyncgit::sync::repository
, right beforeRepository::open_ext
, and it was even faster.git2
without hash verification or caching: about 10 sEdit 2024-06-16: I also got flamegraphs for both implementations that I could share.
Edit 2024-06-17: I added numbers for
features = ["max-performance"]
. I’ll later also add a flamegraph and will testuse_commit_graph(true)
.Edit 2024-06-18: I added numbers for
git2
without hash verification or caching.