Skip to content

Commit

Permalink
chore(bench): add benchmark script
Browse files Browse the repository at this point in the history
This is neat for comparing different tools
  • Loading branch information
EdJoPaTo committed Aug 21, 2024
1 parent e4ac2e6 commit a338b59
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions bench.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -eu -o pipefail

BASE_DIR=$HOME/git
WARMUP=3

# Hint: fd is named fdfind in Debian repos (package: fd-find)

hyperfine --shell=none --warmup $WARMUP \
"find $BASE_DIR -name '.git' -type d" \
"fd --threads=1 --type=directory --prune --no-ignore-vcs --hidden '^\.git$' $BASE_DIR" \
"fd --threads=1 --type=directory --prune --no-ignore-vcs --hidden --glob '.git' $BASE_DIR" \
"project-below --base-dir $BASE_DIR --directory=.git"

hyperfine --shell=none --warmup $WARMUP \
"find $BASE_DIR -type f -name package.json" \
"fd --threads=1 --type=file '^package\.json$' $BASE_DIR" \
"fd --threads=1 --type=file --glob package.json $BASE_DIR" \
"rg --threads=1 --files --glob=package.json $BASE_DIR" \
"project-below --base-dir $BASE_DIR --file=package.json"

hyperfine --shell=none --warmup $WARMUP \
"find $BASE_DIR -type f -name Cargo.toml" \
"fd --threads=1 --type=file '^Cargo\.toml$' $BASE_DIR" \
"fd --threads=1 --type=file --glob Cargo.toml $BASE_DIR" \
"rg --threads=1 --files --glob=Cargo.toml $BASE_DIR" \
"project-below --base-dir $BASE_DIR --file=Cargo.toml"

0 comments on commit a338b59

Please sign in to comment.