glob/bench.sh

30 lines
590 B
Bash
Raw Normal View History

2016-02-24 00:49:41 +03:00
#! /bin/bash
bench() {
2019-02-06 23:48:06 +03:00
if [[ -z $2 ]]; then
$2 = ".*"
fi
filename="/tmp/$1.bench"
2016-02-24 00:49:41 +03:00
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 23:25:01 +03:00
sleep 5
2016-02-24 00:49:41 +03:00
fi
}
to=$1
current=`git rev-parse --abbrev-ref HEAD`
bench ${to} $2
bench ${current} $2
2019-02-06 23:48:06 +03:00
benchcmp $3 "/tmp/${to}.bench" "/tmp/${current}.bench"