-
-
Notifications
You must be signed in to change notification settings - Fork 605
PoC: Use gitoxide for rev walk #2269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
That's all very exciting, thanks for getting started with I think it's worth noting that This |
@cruessler did you ever benchmark this? |
@extrawurst Yes, at the time I added the numbers in the first post, under “git2 without hash verification or caching”. It was even faster than |
That is interesting! A note on Something that seems strange here is that the numbers don't seem to match my own. For instance, a simple commit traversal (that cannot use the commit-graph cache) can be done (with a hot FS-cache) at 138k commits/s on an M1 Pro.
That code uses a the It would certainly be interesting, @cruessler, to see what Damaged pride aside 😅, I am glad that |
To add a bit more context: I’ve created https://github.com/cruessler/gix-benchmarks in order to be able to more thoroughly compare history traversal speed of both Also: I did not know about The benchmark has |
This is very promising! |
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.