summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Peter <mail@david-peter.de>2023-12-19 11:10:54 +0100
committerDavid Peter <sharkdp@users.noreply.github.com>2023-12-19 11:28:59 +0100
commit61ebd9be6a0c0e380028509be9553aac7931fe08 (patch)
treeb9d1b7ce0bb045d0afb935b92d6444015cc17bab
parente3b40208d5cc3e0469f703637475a344aafdc772 (diff)
Update benchmark results
-rw-r--r--README.md62
1 files changed, 23 insertions, 39 deletions
diff --git a/README.md b/README.md
index d8e1327..2e89126 100644
--- a/README.md
+++ b/README.md
@@ -331,61 +331,45 @@ Options:
## Benchmark
-Let's search my home folder for files that end in `[0-9].jpg`. It contains ~190.000
-subdirectories and about a million files. For averaging and statistical analysis, I'm using
+Let's search my home folder for files that end in `[0-9].jpg`. It contains ~750.000
+subdirectories and about a 4 million files. For averaging and statistical analysis, I'm using
[hyperfine](https://github.com/sharkdp/hyperfine). The following benchmarks are performed
with a "warm"/pre-filled disk-cache (results for a "cold" disk-cache show the same trends).
Let's start with `find`:
```
-Benchmark #1: find ~ -iregex '.*[0-9]\.jpg$'
-
- Time (mean ± σ): 7.236 s ± 0.090 s
-
- Range (min … max): 7.133 s … 7.385 s
+Benchmark 1: find ~ -iregex '.*[0-9]\.jpg$'
+ Time (mean ± σ): 19.922 s ± 0.109 s
+ Range (min … max): 19.765 s … 20.065 s
```
`find` is much faster if it does not need to perform a regular-expression search:
```
-Benchmark #2: find ~ -iname '*[0-9].jpg'
-
- Time (mean ± σ): 3.914 s ± 0.027 s
-
- Range (min … max): 3.876 s … 3.964 s
+Benchmark 2: find ~ -iname '*[0-9].jpg'
+ Time (mean ± σ): 11.226 s ± 0.104 s
+ Range (min … max): 11.119 s … 11.466 s
```
-Now let's try the same for `fd`. Note that `fd` *always* performs a regular expression
-search. The options `--hidden` and `--no-ignore` are needed for a fair comparison,
-otherwise `fd` does not have to traverse hidden folders and ignored paths (see below):
+Now let's try the same for `fd`. Note that `fd` performs a regular expression
+search by defautl. The options `-u`/`--unrestricted` option is needed here for
+a fair comparison. Otherwise `fd` does not have to traverse hidden folders and
+ignored paths (see below):
```
-Benchmark #3: fd -HI '.*[0-9]\.jpg$' ~
-
- Time (mean ± σ): 811.6 ms ± 26.9 ms
-
- Range (min … max): 786.0 ms … 870.7 ms
-```
-For this particular example, `fd` is approximately nine times faster than `find -iregex`
-and about five times faster than `find -iname`. By the way, both tools found the exact
-same 20880 files :smile:.
-
-Finally, let's run `fd` without `--hidden` and `--no-ignore` (this can lead to different
-search results, of course). If *fd* does not have to traverse the hidden and git-ignored
-folders, it is almost an order of magnitude faster:
-```
-Benchmark #4: fd '[0-9]\.jpg$' ~
-
- Time (mean ± σ): 123.7 ms ± 6.0 ms
-
- Range (min … max): 118.8 ms … 140.0 ms
+Benchmark 3: fd -u '[0-9]\.jpg$' ~
+ Time (mean ± σ): 854.8 ms ± 10.0 ms
+ Range (min … max): 839.2 ms … 868.9 ms
```
+For this particular example, `fd` is approximately **23 times faster** than `find -iregex`
+and about **13 times faster** than `find -iname`. By the way, both tools found the exact
+same 546 files :smile:.
-**Note**: This is *one particular* benchmark on *one particular* machine. While I have
-performed quite a lot of different tests (and found consistent results), things might
-be different for you! I encourage everyone to try it out on their own. See
+**Note**: This is *one particular* benchmark on *one particular* machine. While we have
+performed a lot of different tests (and found consistent results), things might
+be different for you! We encourage everyone to try it out on their own. See
[this repository](https://github.com/sharkdp/fd-benchmarks) for all necessary scripts.
-Concerning *fd*'s speed, the main credit goes to the `regex` and `ignore` crates that are also used
-in [ripgrep](https://github.com/BurntSushi/ripgrep) (check it out!).
+Concerning *fd*'s speed, a lot of credit goes to the `regex` and `ignore` crates that are
+also used in [ripgrep](https://github.com/BurntSushi/ripgrep) (check it out!).
## Troubleshooting