forked from mirror/glob
wip
This commit is contained in:
parent
6f2a897df2
commit
9bf042f426
16
bench.sh
16
bench.sh
|
@ -1,18 +1,22 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
|
tmp=$(mktemp -d /tmp/globbench.XXXXXX)
|
||||||
|
echo "temp dir is $tmp";
|
||||||
|
|
||||||
bench() {
|
bench() {
|
||||||
if [[ -z $2 ]]; then
|
local exp=".*"
|
||||||
$2 = ".*"
|
if [[ ! -z $2 ]]; then
|
||||||
|
$exp = $2
|
||||||
fi
|
fi
|
||||||
filename="/tmp/$1.bench"
|
filename="$tmp/$1.bench"
|
||||||
if test -e "${filename}";
|
if test -e "${filename}";
|
||||||
then
|
then
|
||||||
echo "Already exists ${filename}"
|
echo "Already exists ${filename}"
|
||||||
else
|
else
|
||||||
backup=`git rev-parse --abbrev-ref HEAD`
|
backup=`git rev-parse --abbrev-ref HEAD`
|
||||||
git checkout $1
|
git checkout "$1"
|
||||||
echo -n "Creating ${filename}... "
|
echo -n "Creating ${filename}... "
|
||||||
go test ./... -run=NONE -bench=$2 > "${filename}" -benchmem
|
go test ./... -run=NONE -bench="$exp" > "${filename}" -benchmem
|
||||||
echo "OK"
|
echo "OK"
|
||||||
git checkout ${backup}
|
git checkout ${backup}
|
||||||
sleep 5
|
sleep 5
|
||||||
|
@ -26,4 +30,4 @@ current=`git rev-parse --abbrev-ref HEAD`
|
||||||
bench ${to} $2
|
bench ${to} $2
|
||||||
bench ${current} $2
|
bench ${current} $2
|
||||||
|
|
||||||
benchcmp $3 "/tmp/${to}.bench" "/tmp/${current}.bench"
|
benchcmp $3 "$tmp/${to}.bench" "$tmp/${current}.bench"
|
||||||
|
|
Loading…
Reference in New Issue