glob/bench.sh

26 lines
536 B
Bash
Raw Normal View History

2016-02-24 00:49:41 +03:00
#! /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`
2016-02-24 13:51:14 +03:00
git checkout $1
2016-02-24 00:49:41 +03:00
echo -n "Creating ${filename}... "
go test ./... -run=NONE -bench=$2 > "${filename}" -benchmem
echo "OK"
2016-02-24 13:51:14 +03:00
git checkout ${backup}
2016-02-24 00:49:41 +03:00
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"