File: bench.sh

package info (click to toggle)
golang-github-gobwas-glob 0.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 340 kB
  • ctags: 502
  • sloc: sh: 20; makefile: 3
file content (26 lines) | stat: -rwxr-xr-x 552 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#! /bin/bash

bench() {
    filename="/tmp/$1-$2.bench"
    if test -e "${filename}";
    then
        echo "Already exists ${filename}"
    else
        backup=`git rev-parse --abbrev-ref HEAD`
        git checkout $1
        echo -n "Creating ${filename}... "
        go test ./... -run=NONE -bench=$2 > "${filename}" -benchmem
        echo "OK"
        git checkout ${backup}
        sleep 5
    fi
}


to=$1
current=`git rev-parse --abbrev-ref HEAD`

bench ${to} $2
bench ${current} $2

benchcmp $3 "/tmp/${to}-$2.bench" "/tmp/${current}-$2.bench"