Update benchmark results
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Peter · committed by GitHub · parent 814d370 · Browse files · 1 file·+27 added−28 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+27 added−28 removed
- other:+27 added−28 removed
Provenance
- Commit
7f65e7a- Tree
faa827d- Author
David Peter <sharkdp@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
814d370
1 file changed+27 added−28 removed
modified:README.md+27 added-28 removed
28 unmodified lines29 30 31 32 ## Benchmark33+33-Let's search my home folder for files that end in `[0-9].jpg`. It contains ~150.00034+Let's search my home folder for files that end in `[0-9].jpg`. It contains ~190.00035 subdirectories and about a million files. For averaging and statistical analysis, I'm using35-[bench](https://github.com/Gabriel439/bench). All benchmarks are performed for a "warm36-cache". Results for a cold cache are similar.36+[hyperfine](https://github.com/sharkdp/hyperfine). The following benchmarks are performed37+with a "warm"/pre-filled disk-cache (results for a "cold" disk-cache show the same trends).38 39 Let's start with `find`:40 ```40-find ~ -iregex '.*[0-9]\.jpg$'41+Benchmark #1: find ~ -iregex '.*[0-9]\.jpg$'42 42-time 6.265 s (6.127 s .. NaN s)43- 1.000 R² (1.000 R² .. 1.000 R²)44-mean 6.162 s (6.140 s .. 6.181 s)45-std dev 31.73 ms (0.0 s .. 33.48 ms)43+ Time (mean ± σ): 7.236 s ± 0.090 s44+ 45+ Range (min … max): 7.133 s … 7.385 s46 ```47 48 `find` is much faster if it does not need to perform a regular-expression search:49 ```50-find ~ -iname '*[0-9].jpg'50+Benchmark #2: find ~ -iname '*[0-9].jpg'51 52-time 2.866 s (2.754 s .. 2.964 s)53- 1.000 R² (0.999 R² .. 1.000 R²)54-mean 2.860 s (2.834 s .. 2.875 s)55-std dev 23.11 ms (0.0 s .. 25.09 ms)52+ Time (mean ± σ): 3.914 s ± 0.027 s53+ 54+ Range (min … max): 3.876 s … 3.964 s55 ```56 57 Now let's try the same for `fd`. Note that `fd` *always* performs a regular expression58 search. The options `--hidden` and `--no-ignore` are needed for a fair comparison,59 otherwise `fd` does not have to traverse hidden folders and ignored paths (see below):60 ```62-fd --hidden --no-ignore '.*[0-9]\.jpg$' ~61+Benchmark #3: fd -HI '.*[0-9]\.jpg$' ~62 64-time 892.6 ms (839.0 ms .. 915.4 ms)65- 0.999 R² (0.997 R² .. 1.000 R²)66-mean 871.2 ms (857.9 ms .. 881.3 ms)67-std dev 15.50 ms (0.0 s .. 17.49 ms)63+ Time (mean ± σ): 811.6 ms ± 26.9 ms64+ 65+ Range (min … max): 786.0 ms … 870.7 ms66 ```69-For this particular example, `fd` is approximately seven times faster than `find -iregex`70-and about three times faster than `find -iname`. By the way, both tools found the exact71-same 14030 files :smile:.67+For this particular example, `fd` is approximately nine times faster than `find -iregex`68+and about five times faster than `find -iname`. By the way, both tools found the exact69+same 20880 files :smile:.70 71 Finally, let's run `fd` without `--hidden` and `--no-ignore` (this can lead to different74-search results, of course):72+search results, of course). If *fd* does not have to traverse the hidden and git-ignored73+folders, it is almost an order of magnitude faster:74 ```76-fd '[0-9]\.jpg$' ~75+Benchmark #4: fd '[0-9]\.jpg$' ~76 78-time 159.5 ms (155.8 ms .. 165.3 ms)79- 0.999 R² (0.996 R² .. 1.000 R²)80-mean 158.7 ms (156.5 ms .. 161.6 ms)81-std dev 3.263 ms (2.401 ms .. 4.298 ms)77+ Time (mean ± σ): 123.7 ms ± 6.0 ms78+ 79+ Range (min … max): 118.8 ms … 140.0 ms80 ```81 82 **Note**: This is *one particular* benchmark on *one particular* machine. While I have83 performed quite a lot of different tests (and found consistent results), things might86-be different for you! I encourage everyone to try it out on their own.84+be different for you! I encourage everyone to try it out on their own. See 85+[this repository](https://github.com/sharkdp/fd-benchmarks) for all necessary scripts.86 87 Concerning *fd*'s speed, the main credit goes to the `regex` and `ignore` crates that are also used88 in [ripgrep](https://github.com/BurntSushi/ripgrep) (check it out!).89 267 unmodified lines