Created
September 16, 2016 19:28
-
-
Save aprice/d757dcb7e8348beed3cbdda544ab98d5 to your computer and use it in GitHub Desktop.
Compare golang benchmarks between working copy and pristine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: benchwc.sh "path/to/package" "-build flags" | |
# e.g. benchwc.sh ./mypkg "-cpu=1,2,4 -tags=debug -benchtime=2s" | |
DIR=${1:-.} | |
BFLAGS=$2 | |
git stash save || exit 1 | |
cd $DIR && go test -run=^$ -bench=. -benchmem $BFLAGS | tee old.out | |
git stash pop || exit 1 | |
cd $DIR && go test -run=^$ -bench=. -benchmem $BFLAGS | tee new.out | |
benchcmp old.out new.out | tee comparison.out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note this requires benchcmp to be installed:
go get golang.org/x/tools/cmd/benchcmp