hugo

Fork of github.com/gohugoio/hugo with reverse pagination support

git clone git://git.shimmy1996.com/hugo.git

bench.sh (859B)

    1 #!/usr/bin/env bash
    2 
    3 # allow user to override go executable by running as GOEXE=xxx make ...
    4 GOEXE="${GOEXE-go}"
    5 
    6 # Convenience script to
    7 # - For a given branch
    8 # - Run  benchmark tests for a given package
    9 # - Do the same for master
   10 # - then compare the two runs with benchcmp
   11 
   12 benchFilter=".*"
   13 
   14 if (( $# < 2 ));
   15   then
   16     echo "USAGE: ./bench.sh <git-branch> <package-to-bench> (and <benchmark filter> (regexp, optional))"
   17     exit 1
   18 fi
   19 
   20 
   21 
   22 if [ $# -eq 3 ]; then
   23   benchFilter=$3
   24 fi
   25 
   26 
   27 BRANCH=$1
   28 PACKAGE=$2
   29 
   30 git checkout $BRANCH
   31 "${GOEXE}" test -test.run=NONE -bench="$benchFilter" -test.benchmem=true ./$PACKAGE > /tmp/bench-$PACKAGE-$BRANCH.txt
   32 
   33 git checkout master
   34 "${GOEXE}" test -test.run=NONE -bench="$benchFilter" -test.benchmem=true ./$PACKAGE > /tmp/bench-$PACKAGE-master.txt
   35 
   36 
   37 benchcmp /tmp/bench-$PACKAGE-master.txt /tmp/bench-$PACKAGE-$BRANCH.txt