Skip to content

Commit d18f6f0

Browse files
committed
chore: add runbench
1 parent f1b5e4d commit d18f6f0

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

run_bench.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env bash
2+
#
3+
# run bench for 2 git hash/branch/tag
4+
#
5+
# ./run_bench.sh [baseline] [compare]
6+
# to only run some bench, use EXTRA_ARGS="--bench interleave_kernels \"interleave list struct.*\"" ./run_bench.sh HEAD main
7+
8+
set -e
9+
10+
function patch_cargo_toml() {
11+
if [[ ! -z $(grep "bench = false" arrow/Cargo.toml) ]]; then
12+
echo "Patch not required"
13+
else
14+
echo "Patch required"
15+
cp arrow/Cargo.toml arrow/Cargo.toml.org
16+
sed '/^\[lib\]/a bench = false' arrow/Cargo.toml.org > arrow/Cargo.toml
17+
fi
18+
}
19+
20+
function run_bench( ) {
21+
cmd="cargo bench ${EXTRA_ARGS} -- --save-baseline arrow-$1"
22+
echo $cmd
23+
bash -c "$cmd"
24+
}
25+
26+
27+
# checkout baseline and run bench
28+
git checkout $1
29+
30+
patch_cargo_toml
31+
run_bench $1
32+
33+
# checkout compare and run bench
34+
git reset --hard
35+
git checkout $2
36+
37+
patch_cargo_toml
38+
run_bench $2

0 commit comments

Comments
 (0)