...
1#! /bin/bash
2
3bench() {
4 filename="/tmp/$1-$2.bench"
5 if test -e "${filename}";
6 then
7 echo "Already exists ${filename}"
8 else
9 backup=`git rev-parse --abbrev-ref HEAD`
10 git checkout $1
11 echo -n "Creating ${filename}... "
12 go test ./... -run=NONE -bench=$2 > "${filename}" -benchmem
13 echo "OK"
14 git checkout ${backup}
15 sleep 5
16 fi
17}
18
19
20to=$1
21current=`git rev-parse --abbrev-ref HEAD`
22
23bench ${to} $2
24bench ${current} $2
25
26benchcmp $3 "/tmp/${to}-$2.bench" "/tmp/${current}-$2.bench"
View as plain text