#!/bin/bash # # This is a small utility that helps run and diff benchmarks, using # "go test -bench" and "benchstat". # # It's only used for development and not meant to be portable, or have a # stable interface. # # Examples: # # Run the benchmarks, recording the output IFF the tree is not dirty. # ./tests/bench # # # Diff between two recorded commits. # benchstat BASE=.bench-history/... LAST=.bench-history/last set -e cd "$(git rev-parse --show-toplevel)" BDIR=".bench-history" mkdir -p $BDIR FNAME="$BDIR/$(date "+%Y-%m-%d-%H:%M")-$(git describe --always --dirty)" echo file: $FNAME go test -bench=. ./... "$@" | tee $FNAME