Merged
Conversation
Change to lazy NAR accessor Timing ``` fmzakari@leviathan ~/c/g/N/nix (master)> command time -f %M -- ./build/src/nix/nix nar ls /tmp/linux.nar / > /dev/null 169936 fmzakari@leviathan ~/c/g/N/nix (master)> command time -f %M -- nix nar ls /tmp/linux.nar / > /dev/null 3680616 ``` fixes NixOS#13944
Ericson2314
reviewed
Oct 16, 2025
fzakaria
commented
Oct 16, 2025
Comment on lines
-148
to
+152
| list(makeNarAccessor(readFile(narPath)), CanonPath{path}); | ||
| AutoCloseFD fd = open(narPath.c_str(), O_RDONLY); | ||
| auto source = FdSource{fd.get()}; | ||
| auto narAccessor = makeNarAccessor(source); | ||
| auto listing = listNar(narAccessor, CanonPath::root, true); | ||
| list(makeLazyNarAccessor(listing, seekableGetNarBytes(narPath)), CanonPath{path}); |
Contributor
Author
There was a problem hiding this comment.
I really tried to remove the std::optional from NarAccessor but it's used by RemoteFSAccessor
I think we can make RemoteFSAccessor a lot faster by also using Sink & Source and not storing the whole memory of the NAR
xokdvium
reviewed
Oct 16, 2025
xokdvium
reviewed
Oct 16, 2025
xokdvium
approved these changes
Oct 16, 2025
xokdvium
added a commit
that referenced
this pull request
Oct 16, 2025
I didn't catch this during the review of #14273. This fixes that mistake.
2 tasks
Contributor
|
TYSM |
Member
|
Just currious if it finds the issue... |
Member
|
Nope. Not this time... |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/path-hasher-a-php-implementation-of-nix-s-nar-format/71222/2 |
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.
Change to lazy NAR accessor so we don't store the complete NAR object in memory.
Timing
We can see nearly a 21x speedup
fixes #13944
Please see the issue for the rationale.
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.