Debian Codegraph @

tests/bench

raw
1 #!/bin/bash
2 #
3 # This is a small utility that helps run and diff benchmarks, using
4 # "go test -bench" and "benchstat".
5 #
6 # It's only used for development and not meant to be portable, or have a
7 # stable interface.
8 #
9 # Examples:
10 # # Run the benchmarks, recording the output IFF the tree is not dirty.
11 # ./tests/bench
12 #
13 # # Diff between two recorded commits.
14 # benchstat BASE=.bench-history/... LAST=.bench-history/last
15
16 set -e
17
18 cd "$(git rev-parse --show-toplevel)"
19
20 BDIR=".bench-history"
21 mkdir -p $BDIR
22
23 FNAME="$BDIR/$(date "+%Y-%m-%d-%H:%M")-$(git describe --always --dirty)"
24
25 echo file: $FNAME
26 go test -bench=. ./... "$@" | tee $FNAME