-
Notifications
You must be signed in to change notification settings - Fork 1
Concerns over readDir
speed
#17
Comments
Just as a reminder the workaround I used was auto-updating a complete manifest of files before each commit. This is a pain in the ass and probably isn't practical in Nixpkgs but I thought I'd mention it. |
Not a recent feature; can be relied on for performance, but technically should have a graceful degradation, which we need anyway. |
The above idea is now being implemented in NixOS/nix#7447. We discussed that PR in today's NAT meeting |
If nix is going to be changed, I don't know if you considered introducing a lazy attrset type, so that the full list of packages doesn't need to be generated. The idea would be to have a constructor that provides an accessor function, and that function is called on first access. EDIT: Actually, this might not work because |
Benchmarking Results: A playground repository was created to test Upfront I want to highlight that this playground largely helps us prove "there is no loss of performance" as opposed to whether or not there is an improvement. This is because Linux and Darwin both implement
|
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2022-01-03-nixpkgs-architecture-team-meeting-23/24404/1 |
readDir
does astat
on all the directories entries to figure out their type. We don't need that information though. There are some ways of making this faster:readDir
lazily stat the entriesbuiltins.listDirectory
which doesn't return the file typesgetdents
which allows reading multiple directory entries at once, not POSIX compatible though, would be opportunistic when availableThis ties into the sharding discussion in #1 , because with sharding, more directories need to be listed.
The text was updated successfully, but these errors were encountered: