Skip to content

Instantly share code, notes, and snippets.

@boutros
Last active August 29, 2015 14:14
Show Gist options
  • Save boutros/1bbe9990a5c43182cbd1 to your computer and use it in GitHub Desktop.
Save boutros/1bbe9990a5c43182cbd1 to your computer and use it in GitHub Desktop.
Go benchmark helper scripts
#!/usr/bin/env bash
num=$1
if [[ -z $num ]] ; then
num=1
fi
benchmarks=$2
if [[ -z $benchmarks ]] ; then
benchmarks="."
fi
git checkout "HEAD~${num}" > /dev/null 2>&1
go test -run=XXX -benchmem=true -bench="${benchmarks}" > old.txt
git checkout master > /dev/null > /dev/null 2>&1
go test -run=XXX -benchmem=true -bench="${benchmarks}" > new.txt
benchcmp -mag=true old.txt new.txt
rm old.txt new.txt
#!/usr/bin/env bash
benchmarks=$1
if [[ -z $benchmarks ]] ; then
benchmarks="."
fi
git stash > /dev/null 2>&1
go test -run=XXX -benchmem=true -bench="${benchmarks}" > old.txt
git stash pop > /dev/null 2>&1
go test -run=XXX -benchmem=true -bench="${benchmarks}" > new.txt
benchcmp -mag=true old.txt new.txt
rm old.txt new.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment