summaryrefslogtreecommitdiffstats
path: root/bench.sh
blob: 27335287d440fcd9c391420b10bd694bea421228 (plain)
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
#!/usr/bin/env bash


# Convenience script to
# - For a given branch
# - Run  benchmark tests for a given package
# - Do the same for master
# - then compare the two runs with benchcmp

if [ $# -ne 2 ]
  then
    echo "USAGE: ./bench.sh <git-branch> <package-to-bench>"
    exit 1
fi


BRANCH=$1
PACKAGE=$2

git checkout $BRANCH
go test -test.run=NONE -bench=".*" -test.benchmem=true ./$PACKAGE > /tmp/bench-$PACKAGE-$BRANCH.txt

git checkout master
go test -test.run=NONE -bench=".*" -test.benchmem=true ./$PACKAGE > /tmp/bench-$PACKAGE-master.txt


benchcmp /tmp/bench-$PACKAGE-master.txt /tmp/bench-$PACKAGE-$BRANCH.txt