-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
libfetchers/git-utils: Do not refresh pack files in GitFileSystemObje… #14696
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
77473ff to
6fd8f4c
Compare
|
Impact on my machine (with the on zfs on an nvme ssd, I expect this to be much more pronounced on systems with slower drives):
(Before) (After) |
…ctSink This leads to incredibly wasteful refreshes (see [^]) when oids are not found. Since we are writing the pack files only once per unpacking we should not bother with this refreshing at all. This brings down the number of syscalls during `nix flake metadata "https://releases.nixos.org/nixos/25.05/nixos-25.05.813095.1c8ba8d3f763/nixexprs.tar.xz" --store "dummy://?read-only=false"` Down from 576334 to just 6235 (100x less syscalls): (Before) % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ------------------ 32.98 0.625288 3 162898 getdents64 29.58 0.560686 3 163514 81917 openat 15.01 0.284509 3 81819 186 newfstatat 10.99 0.208349 2 81601 close 10.56 0.200145 2 81552 fstat All these are coming from [2] and are totally useless. (After) % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ------------------ 76.47 0.108558 247 438 20 futex 6.55 0.009292 18 513 munmap 3.30 0.004680 7 639 492 openat 2.68 0.003803 10 359 write 2.30 0.003268 2 1146 read 2.26 0.003215 3 870 mmap [^]: https://github.com/libgit2/libgit2/blob/58d9363f02f1fa39e46d49b604f27008e75b72f2/include/git2/sys/odb_backend.h#L68-L75 [2]: https://github.com/libgit2/libgit2/blob/58d9363f02f1fa39e46d49b604f27008e75b72f2/src/libgit2/odb_pack.c#L517-L546
6fd8f4c to
d1f9fe9
Compare
| unset it in the vtable. libgit2 does nothing if it's a nullptr: | ||
| https://github.com/libgit2/libgit2/blob/58d9363f02f1fa39e46d49b604f27008e75b72f2/src/libgit2/odb.c#L1922 | ||
| */ | ||
| packfileOdbRefresh = std::exchange(backend->refresh, nullptr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this different than
packfileOdbRefresh = backend->refresh;
backend->refresh = nullptr;
?
| /* We are done writing blobs, can restore refresh functionality. */ | ||
| backend->refresh = packfileOdbRefresh; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume that the status of repo->packBackend never changes for a given repo?
|
I don't know if it's this or one of the other git optimizations, but I see errors about missing commits from repos. Unfortunately I didn't copy the exact error and now it went away. will do the next time i see it. |
|
Unclear now if this was the actual root cause or it's an issue maybe fixed by #14620 Will do more testing after I rebased again. |
…ctSink
Motivation
This leads to incredibly wasteful refreshes (see ^) when oids are not found. Since we are writing the pack files only once per unpacking we should not bother with this refreshing at all.
This brings down the number of syscalls during
nix flake metadata "https://releases.nixos.org/nixos/25.05/nixos-25.05.813095.1c8ba8d3f763/nixexprs.tar.xz" --store "dummy://?read-only=false"Down from 576334 to just 6235 (100x less syscalls):
(Before)
All these are coming from 2 and are totally useless.
(After)
Context
Natural follow-up to #14689.
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.