5
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2024-11-25 16:51:35 +00:00
matterbridge/vendor/github.com/pelletier/go-toml/benchmark.sh

36 lines
963 B
Bash
Raw Normal View History

#!/bin/bash
2020-08-09 22:29:54 +00:00
set -ex
reference_ref=${1:-master}
reference_git=${2:-.}
if ! `hash benchstat 2>/dev/null`; then
echo "Installing benchstat"
go get golang.org/x/perf/cmd/benchstat
fi
tempdir=`mktemp -d /tmp/go-toml-benchmark-XXXXXX`
ref_tempdir="${tempdir}/ref"
ref_benchmark="${ref_tempdir}/benchmark-`echo -n ${reference_ref}|tr -s '/' '-'`.txt"
local_benchmark="`pwd`/benchmark-local.txt"
echo "=== ${reference_ref} (${ref_tempdir})"
git clone ${reference_git} ${ref_tempdir} >/dev/null 2>/dev/null
pushd ${ref_tempdir} >/dev/null
git checkout ${reference_ref} >/dev/null 2>/dev/null
go test -bench=. -benchmem | tee ${ref_benchmark}
2020-12-31 13:48:12 +00:00
cd benchmark
go test -bench=. -benchmem | tee -a ${ref_benchmark}
popd >/dev/null
echo ""
echo "=== local"
go test -bench=. -benchmem | tee ${local_benchmark}
2020-12-31 13:48:12 +00:00
cd benchmark
go test -bench=. -benchmem | tee -a ${local_benchmark}
echo ""
echo "=== diff"
2020-08-09 22:29:54 +00:00
benchstat -delta-test=none ${ref_benchmark} ${local_benchmark}