Skip to content

Commit bef92ba

Browse files
committed
Add convenience script to run benchmarks
1 parent be1a566 commit bef92ba

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
hugo
22
docs/public*
3+
/.idea
34
hugo.exe
45
*.test
56
*.prof

bench.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
3+
4+
# Convenience script to
5+
# - For a given branch
6+
# - Run benchmark tests for a given package
7+
# - Do the same for master
8+
# - then compare the two runs with benchcmp
9+
10+
if [ $# -ne 2 ]
11+
then
12+
echo "USAGE: ./bench.sh <git-branch> <package-to-bench>"
13+
exit 1
14+
fi
15+
16+
17+
BRANCH=$1
18+
PACKAGE=$2
19+
20+
git checkout $BRANCH
21+
go test -test.run=NONE -bench=".*" -test.benchmem=true ./$PACKAGE > /tmp/bench-$PACKAGE-$BRANCH.txt
22+
23+
git checkout master
24+
go test -test.run=NONE -bench=".*" -test.benchmem=true ./$PACKAGE > /tmp/bench-$PACKAGE-master.txt
25+
26+
27+
benchcmp /tmp/bench-$PACKAGE-master.txt /tmp/bench-$PACKAGE-$BRANCH.txt

0 commit comments

Comments
 (0)