You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently ran into a scenario where fd could be improved. If the pattern contains the start-of-string (^), fd will continue trying all entries under a subdirectory even if its parent does not 'partially match' the pattern. I ran into a situation where it took several minutes to try to find some files using fd whereas find finished in a few seconds (I assume because it does support pruning with a regex that contains start-of-string -- I did not verify this by looking at the source yet).
The fd command that I had used to compare the performance between the two was: fdfind <regex> <root-dir> --full-path
and the find command was: find <root-dir> -regex <regex>
where regex could look like: ^/mnt/foo/bar/([^/]*)/([^/]*)/(baz|qux)/...
Note: This is different than --prune as that option only skips the subdirectory tree if there's a match.
The ideal behavior here is to skip the subdirectory tree if it's impossible to have a match (because there's no partial match) only when matching against full path. If there is not a partial regex match for any of the patterns when we're trying to matching against an full path, then prune (return ignore::WalkState::Skip).
FYI I don't believe the Rust regex library current supports partial matching (rust-lang/regex#678).
The text was updated successfully, but these errors were encountered:
I recently ran into a scenario where
fd
could be improved. If the pattern contains the start-of-string (^
), fd will continue trying all entries under a subdirectory even if its parent does not 'partially match' the pattern. I ran into a situation where it took several minutes to try to find some files usingfd
whereasfind
finished in a few seconds (I assume because it does support pruning with a regex that contains start-of-string -- I did not verify this by looking at the source yet).The fd command that I had used to compare the performance between the two was:
fdfind <regex> <root-dir> --full-path
and the find command was:
find <root-dir> -regex <regex>
where regex could look like:
^/mnt/foo/bar/([^/]*)/([^/]*)/(baz|qux)/
...Note: This is different than
--prune
as that option only skips the subdirectory tree if there's a match.The ideal behavior here is to skip the subdirectory tree if it's impossible to have a match (because there's no partial match) only when matching against full path. If there is not a partial regex match for any of the patterns when we're trying to matching against an full path, then prune (return ignore::WalkState::Skip).
FYI I don't believe the Rust regex library current supports partial matching (rust-lang/regex#678).
The text was updated successfully, but these errors were encountered: