From 3dc92f7b54b9108559e334c2fbd09cbe1eefdfe9 Mon Sep 17 00:00:00 2001 From: gobwas Date: Wed, 24 Feb 2016 00:49:41 +0300 Subject: [PATCH] benchmarking script --- bench.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 bench.sh diff --git a/bench.sh b/bench.sh new file mode 100755 index 0000000..5264052 --- /dev/null +++ b/bench.sh @@ -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"