Repository navigation
find: look up each owner and group name once - #1033
Merged
Merged
Conversation
Merging this PR will not alter performance1 warning
Comparing |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1033 +/- ##
==========================================
+ Coverage 92.26% 92.29% +0.03%
==========================================
Files 37 38 +1
Lines 8678 8714 +36
Branches 429 429
==========================================
+ Hits 8007 8043 +36
Misses 532 532
Partials 139 139 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
sylvestre
reviewed
Nov 21, 2026
Contributor
|
Thanks for your PR |
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.
find -lslooks up the owner and group name of every file it prints, and each lookup reads/etc/passwdand/etc/groupagain. On/usr/share(33,907 entries) that is 71,025openatcalls, against 3,250 for GNU find.-printf %uand%gdo the same.A tree usually has only a few owners, so this keeps each name after its first lookup:
names.rsholds a uid → name and a gid → name map, used by-lsand-printf %u/%g.hyperfine, 20 runs, Ubuntu 24.04:
find /usr/share ...-ls-printf '%u:%g\n'Output and exit code are the same as main for
-lsand-printf %u:%g:%U:%Gon/usr/shareand on a tree owned by root, ubuntu, nobody and an unmapped uid/gid (54321).cargo test, clippy and fmt pass.Part of #430 (the user/group name cache).