Skip to content

Commit d6e327a

Browse files
author
Raghuveer Devulapalli
authored
Merge pull request #84 from r-devulap/bench-script
Add option to compare benchmarks across branches
2 parents 3766740 + 207e2a9 commit d6e327a

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

run-bench.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
parser = argparse.ArgumentParser()
66
parser.add_argument('--branchcompare', action='store_true', help='Compare benchmarks of current branch with main. Provide an optional --filter')
7+
parser.add_argument("-b", '--branch', type=str, default="main", required=False)
78
parser.add_argument('--benchcompare', type=str, help='Compare simd bench with stdsort methods. Requires one of qsort, qselect, partialsort, argsort or argselect')
89
parser.add_argument("-f", '--filter', type=str, required=False)
910
args = parser.parse_args()
@@ -36,7 +37,8 @@
3637
rc = subprocess.check_call("./scripts/bench-compare.sh '%s' '%s'" % (baseline, contender), shell=True)
3738

3839
if args.branchcompare:
40+
branch = args.branch
3941
if args.filter is None:
40-
rc = subprocess.call("./scripts/branch-compare.sh")
42+
rc = subprocess.check_call("./scripts/branch-compare.sh '%s'" % (branch), shell=True)
4143
else:
42-
rc = subprocess.check_call("./scripts/branch-compare.sh '%s'" % args.filter, shell=True)
44+
rc = subprocess.check_call("./scripts/branch-compare.sh '%s' '%s'" % (branch, args.filter), shell=True)

scripts/branch-compare.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ BASE_DIR=$(dirname $SCRIPT_DIR)
55
branch=$(git rev-parse --abbrev-ref HEAD)
66
#br_commit=$(git rev-parse $branch)
77
#main_commit=$(git rev-parse main)
8-
echo "Comparing main branch with $branch"
8+
basebranch=$1
9+
echo "Comparing $basebranch branch with $branch"
910

1011
build_branch() {
1112
dir_name=$1
@@ -39,14 +40,14 @@ if [ ! -d google-benchmark ]; then
3940
fi
4041
compare=$(realpath google-benchmark/tools/compare.py)
4142
build_branch $branch
42-
build_branch "main"
43+
build_branch $basebranch
4344
contender=$(realpath ${branch}/builddir/benchexe)
44-
baseline=$(realpath main/builddir/benchexe)
45+
baseline=$(realpath ${basebranch}/builddir/benchexe)
4546

46-
if [ -z "$1" ]; then
47+
if [ -z "$2" ]; then
4748
echo "Comparing all benchmarks .."
4849
$compare benchmarks $baseline $contender
4950
else
50-
echo "Comparing benchmark $1 .."
51-
$compare benchmarksfiltered $baseline $1 $contender $1
51+
echo "Comparing benchmark $2 .."
52+
$compare benchmarksfiltered $baseline $2 $contender $2
5253
fi

0 commit comments

Comments
 (0)