-
-
Notifications
You must be signed in to change notification settings - Fork 979
Description
Checks
- I have read the troubleshooting section and still think this is a bug.
Describe the bug you encountered:
(I'm not sure if we count performance issues as a bug or not)
See sharkdp/fd-benchmarks#5 for repro
I am building the world's fastest application launcher for GNU+Linux. I thought fd would be a good choice for finding applications, but after benchmarking I found that GNU find can be 9 times faster than fd. Am I using fd wrong, or in this case is GNU find faster?
Describe what you expected to happen:
Reproduction steps:
Run ./warm-cache-exe-paths.sh in sharkdp/fd-benchmarks#5
1. download https://github.com/vegerot/dotfiles/blob/a9a50230d808572173d3eeec057739d0fe8d4470/bin/fzf-menu
2. Run
$ hyperfine -w2 -n "BSD find" "FIND_PROG=find FIND_ARGS='-maxdepth 1 -perm +111 -type f,l -exec basename {} ;' fzf-menu --list-programs" \
-n "GNU find" "FIND_PROG=gfind FIND_ARGS='-maxdepth 1 -executable -printf %f\n' fzf-menu --list-programs" \
-n "fd" "FIND_PROG='fd .' FIND_ARGS='--max-depth=1 --type=executable --exec basename {} ;' fzf-menu --list-programs"
(note: this is on macOS. I reprod on GNU+Linux as well but didn't measure BSD find)
Expected: fd to be the fastest.
Actual:
$ hyperfine -w2 -n "BSD find" "FIND_PROG=find FIND_ARGS='-maxdepth 1 -perm +111 -type f,l -exec basename {} ;' fzf-menu --list-programs" \
-n "GNU find" "FIND_PROG=gfind FIND_ARGS='-maxdepth 1 -executable -printf %f\n' fzf-menu --list-programs" \
-n "fd" "FIND_PROG='fd .' FIND_ARGS='--max-depth=1 --type=executable --exec basename {} ;' fzf-menu --list-programs"
Benchmark 1: BSD find
Time (mean ± σ): 4.865 s ± 0.191 s [User: 0.785 s, System: 2.254 s]
Range (min … max): 4.623 s … 5.089 s 10 runs
Benchmark 2: GNU find
Time (mean ± σ): 133.9 ms ± 9.3 ms [User: 30.9 ms, System: 66.0 ms]
Range (min … max): 126.0 ms … 165.7 ms 21 runs
Benchmark 3: fd
Time (mean ± σ): 1.198 s ± 0.055 s [User: 1.008 s, System: 4.774 s]
Range (min … max): 1.125 s … 1.311 s 10 runs
Summary
GNU find ran
8.95 ± 0.74 times faster than fd
36.35 ± 2.89 times faster than BSD find
What version of fd are you using?
fd 10.2.0
Which operating system / distribution are you on?
Reprod on:
- Darwin 23.6.0 arm64
- Debian 12 Linux 6.1.0-23-amd64 x86_64Is there a way I can use fd that will make it faster than GNU find, or for my particular application is GNU find just better?
Please see sharkdp/fd-benchmarks#5 for repro