benchmarking script

This commit is contained in:
gobwas 2016-02-24 00:49:41 +03:00
parent 8de721a7a4
commit 3dc92f7b54
1 changed files with 25 additions and 0 deletions

25
bench.sh Executable file
View File

@ -0,0 +1,25 @@
#! /bin/bash
bench() {
filename="/tmp/$1-$2.bench"
if test -e "${filename}";
then
echo "Already exists ${filename}"
else
backup=`git rev-parse --abbrev-ref HEAD`
git checkout $1 &>/dev/null
echo -n "Creating ${filename}... "
go test ./... -run=NONE -bench=$2 > "${filename}" -benchmem
echo "OK"
git checkout ${backup} &>/dev/null
fi
}
to=$1
current=`git rev-parse --abbrev-ref HEAD`
bench ${to} $2
bench ${current} $2
benchcmp $3 "/tmp/${to}-$2.bench" "/tmp/${current}-$2.bench"