Skip to content

Instantly share code, notes, and snippets.

@ggreer
Created April 11, 2018 19:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ggreer/12c5dfeeb592725db8432b7f974b66dd to your computer and use it in GitHub Desktop.
Save ggreer/12c5dfeeb592725db8432b7f974b66dd to your computer and use it in GitHub Desktop.
#!/bin/bash
function benchmark_rev() {
REV=$1
git clean -f &> /dev/null
git checkout $REV &> /dev/null
git clean -f &> /dev/null
if [ $? -ne 0 ]; then
echo "Checkout of $REV failed!"
exit 1
fi
./build.sh &> /dev/null
if [ $? -ne 0 ]; then
echo "[\"$REV\", null, \"Build failed\" 0, 0, 0],"
fi
# filter out occasional debugging lines I printed out
TIME1=`./ag --stats functionName ~/code/ 2>&1 | ag -s seconds| tail -n 1 | awk '{print $1}'`
TIME2=`./ag --stats '^function.*nName' ~/code/ 2>&1 | tail -n 5 | ag -s seconds | tail -n 1 | awk '{print $1}'`
TIME3=`./ag --stats -i functionname ~/code/ 2>&1 | ag -s seconds | tail -n 1 | awk '{print $1}'`
echo "[\"$REV\", null, null, $TIME1, $TIME2, $TIME3],"
}
REV_LIST=`git tag -l | sort -V`
# 6a38fb74 is the first rev that supports --stats
#REV_LIST=`git rev-list --reverse 6a38fb74..master`
for rev in $REV_LIST; do
benchmark_rev $rev
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment