Skip to content

Commit cd4a909

Browse files
author
Raghuveer Devulapalli
committed
Improvment to benchmarking scripts
1 parent 0890de5 commit cd4a909

File tree

2 files changed

+29
-36
lines changed

2 files changed

+29
-36
lines changed

scripts/bench-compare.sh

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@ set -e
33
branch=$(git rev-parse --abbrev-ref HEAD)
44
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
55
cd $SCRIPT_DIR/..
6-
if [[ -z "${GBENCH}" ]]; then
7-
echo "Please set env variable GBENCH and re run"
8-
exit 1
9-
fi
106

11-
compare=$GBENCH/tools/compare.py
12-
if [ ! -f $compare ]; then
13-
echo "Unable to locate $GBENCH/tools/compare.py"
14-
exit 1
7+
## Get google-benchmark
8+
mkdir -p .bench
9+
if [ ! -d .bench/google-benchmark ]; then
10+
git clone https://github.com/google/benchmark .bench/google-benchmark
1511
fi
12+
compare=$(realpath .bench/google-benchmark/tools/compare.py)
1613

1714
meson setup --warnlevel 0 --buildtype plain builddir-${branch}
1815
cd builddir-${branch}

scripts/branch-compare.sh

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,37 @@ set -e
33
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
44
BASE_DIR=$(dirname $SCRIPT_DIR)
55
branch=$(git rev-parse --abbrev-ref HEAD)
6+
br_commit=$(git rev-parse $branch)
7+
main_commit=$(git rev-parse main)
68
echo "Comparing main branch with $branch"
79

8-
if [[ -z "${GBENCH}" ]]; then
9-
echo "Please set env variable GBENCH and re run"
10-
exit 1
11-
fi
10+
build_branch() {
11+
dir_name=$1
12+
if [ ! -d $dir_name ]; then
13+
git clone -b $branch ${BASE_DIR} $dir_name
14+
fi
15+
cd $dir_name
16+
meson setup --warnlevel 0 --buildtype plain builddir
17+
cd builddir
18+
ninja
19+
cd ../../
20+
}
1221

13-
compare=$GBENCH/tools/compare.py
14-
if [ ! -f $compare ]; then
15-
echo "Unable to locate $GBENCH/tools/compare.py"
16-
exit 1
22+
mkdir -p .bench
23+
cd .bench
24+
if [ ! -d google-benchmark ]; then
25+
git clone https://github.com/google/benchmark google-benchmark
1726
fi
27+
compare=$(realpath google-benchmark/tools/compare.py)
28+
build_branch $br_commit
29+
build_branch $main_commit
30+
baseline=$(realpath ${main_commit}/builddir/benchexe)
31+
contender=$(realpath ${br_commit}/builddir/benchexe)
1832

19-
rm -rf .bench-compare
20-
mkdir .bench-compare
21-
cd .bench-compare
22-
echo "Fetching and build $branch .."
23-
git clone ${BASE_DIR} -b $branch .
24-
git fetch origin
25-
meson setup --warnlevel 0 --buildtype plain builddir-${branch}
26-
cd builddir-${branch}
27-
ninja
28-
echo "Fetching and build main .."
29-
cd ..
30-
git remote add upstream https://github.com/intel/x86-simd-sort.git
31-
git fetch upstream
32-
git checkout upstream/main
33-
meson setup --warnlevel 0 --buildtype plain builddir-main
34-
cd builddir-main
35-
ninja
36-
cd ..
3733
if [ -z "$1" ]; then
3834
echo "Comparing all benchmarks .."
39-
$compare benchmarks ./builddir-main/benchexe ./builddir-${branch}/benchexe
35+
$compare benchmarks $baseline $contender
4036
else
4137
echo "Comparing benchmark $1 .."
42-
$compare benchmarksfiltered ./builddir-main/benchexe $1 ./builddir-${branch}/benchexe $1
38+
$compare benchmarksfiltered $baseline $1 $contender $1
4339
fi

0 commit comments

Comments
 (0)