forked from mirrors/gotosocial
0884f89431
* start pulling out + replacing urfave and config * replace many many instances of config * move more stuff => viper * properly remove urfave * move some flags to root command * add testrig commands to root * alias config file keys * start adding cli parsing tests * reorder viper init * remove config path alias * fmt * change config file keys to non-nested * we're more or less in business now * tidy up the common func * go fmt * get tests passing again * add note about the cliparsing tests * reorganize * update docs with changes * structure cmd dir better * rename + move some files around * fix dangling comma
35 lines
963 B
Bash
35 lines
963 B
Bash
#!/bin/bash
|
|
|
|
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}
|
|
cd benchmark
|
|
go test -bench=. -benchmem | tee -a ${ref_benchmark}
|
|
popd >/dev/null
|
|
|
|
echo ""
|
|
echo "=== local"
|
|
go test -bench=. -benchmem | tee ${local_benchmark}
|
|
cd benchmark
|
|
go test -bench=. -benchmem | tee -a ${local_benchmark}
|
|
|
|
echo ""
|
|
echo "=== diff"
|
|
benchstat -delta-test=none ${ref_benchmark} ${local_benchmark}
|