-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
regression.sh
executable file
·109 lines (92 loc) · 3.65 KB
/
regression.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
#
# This script runs benchmarks comparing two different `fd` binaries.
#
# You should compile the two binaries you want to test, then move them
# into this directory as `fd-master` and `fd-feature` (or change the `FD1` and
# `FD2` paths below).
source "prelude.sh"
FD1="./fd-master"
FD2="./fd-feature"
RESULT_DIR="regression-results"
REPORT="$RESULT_DIR/report.md"
heading() {
bold=$(tput bold)$(tput setaf 220)
normal=$(tput sgr0)
echo
echo
printf "\n%s%s%s\n\n" "$bold" "$1" "$normal"
echo -e "\n### $1\n" >> "$REPORT"
}
mkdir -p "$RESULT_DIR"
rm -f "$RESULT_DIR"/*.md
echo "## \`fd\` regression benchmark" >> "$REPORT"
heading "Interactive output"
hyperfine --warmup "$WARMUP_COUNT" \
"$FD1 '' '$SEARCH_ROOT'" \
"$FD2 '' '$SEARCH_ROOT'" \
--show-output \
--export-markdown "$RESULT_DIR/00-interactive-output.md" \
--export-json "$RESULT_DIR/00-interactive-output.json"
cat "$RESULT_DIR/00-interactive-output.md" >> "$REPORT"
heading "No pattern"
hyperfine --warmup "$WARMUP_COUNT" \
"$FD1 --hidden --no-ignore '' '$SEARCH_ROOT'" \
"$FD2 --hidden --no-ignore '' '$SEARCH_ROOT'" \
--export-markdown "$RESULT_DIR/01-no-pattern.md" \
--export-json "$RESULT_DIR/01-no-pattern.json"
cat "$RESULT_DIR/01-no-pattern.md" >> "$REPORT"
heading "Simple pattern"
hyperfine --warmup "$WARMUP_COUNT" \
"$FD1 '.*[0-9]\\.jpg$' '$SEARCH_ROOT'" \
"$FD2 '.*[0-9]\\.jpg$' '$SEARCH_ROOT'" \
--export-markdown "$RESULT_DIR/02-simple-pattern.md" \
--export-json "$RESULT_DIR/02-simple-pattern.json"
cat "$RESULT_DIR/02-simple-pattern.md" >> "$REPORT"
heading "Simple pattern (-HI)"
hyperfine --warmup "$WARMUP_COUNT" \
"$FD1 -HI '.*[0-9]\\.jpg$' '$SEARCH_ROOT'" \
"$FD2 -HI '.*[0-9]\\.jpg$' '$SEARCH_ROOT'" \
--export-markdown "$RESULT_DIR/03-simple-pattern-all.md" \
--export-json "$RESULT_DIR/03-simple-pattern-all.json"
cat "$RESULT_DIR/03-simple-pattern-all.md" >> "$REPORT"
heading "File extension"
hyperfine --warmup "$WARMUP_COUNT" \
"$FD1 -HI --extension jpg '' '$SEARCH_ROOT'" \
"$FD2 -HI --extension jpg '' '$SEARCH_ROOT'" \
--export-markdown "$RESULT_DIR/04-file-extension.md" \
--export-json "$RESULT_DIR/04-file-extension.json"
cat "$RESULT_DIR/04-file-extension.md" >> "$REPORT"
heading "File type"
hyperfine --warmup "$WARMUP_COUNT" \
"$FD1 -HI --type l '' '$SEARCH_ROOT'" \
"$FD2 -HI --type l '' '$SEARCH_ROOT'" \
--export-markdown "$RESULT_DIR/05-file-type.md" \
--export-json "$RESULT_DIR/05-file-type.json"
cat "$RESULT_DIR/05-file-type.md" >> "$REPORT"
heading "Command execution"
hyperfine --warmup "$WARMUP_COUNT" \
"$FD1 'ab' '$SEARCH_ROOT' --exec echo" \
"$FD2 'ab' '$SEARCH_ROOT' --exec echo" \
--export-markdown "$RESULT_DIR/06-command-execution.md" \
--export-json "$RESULT_DIR/06-command-execution.json"
cat "$RESULT_DIR/06-command-execution.md" >> "$REPORT"
heading "Command execution (large output)"
hyperfine --warmup "$WARMUP_COUNT" \
"$FD1 -tf 'ab' '$SEARCH_ROOT' --exec cat" \
"$FD2 -tf 'ab' '$SEARCH_ROOT' --exec cat" \
--export-markdown "$RESULT_DIR/07-command-execution.md" \
--export-json "$RESULT_DIR/07-command-execution.json"
cat "$RESULT_DIR/07-command-execution.md" >> "$REPORT"
ask_for_sudo
heading "Cold cache"
hyperfine \
--min-runs 3 \
--prepare "$RESET_CACHES" \
"$FD1 -HI '.*[0-9]\.jpg$' '$SEARCH_ROOT'" \
"$FD2 -HI '.*[0-9]\.jpg$' '$SEARCH_ROOT'" \
--export-markdown "$RESULT_DIR/07-simple-pattern-cold-cache.md" \
--export-json "$RESULT_DIR/07-simple-pattern-cold-cache.json"
cat "$RESULT_DIR/07-simple-pattern-cold-cache.md" >> "$REPORT"
echo
echo "Wrote markdown report to '$RESULT_DIR/report.md'"