-
Notifications
You must be signed in to change notification settings - Fork 645
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds a way to compare benchmarks that we use in kube-state-metrics already, hopefully allowing for better comparisons when applying changes. Signed-off-by: Manuel Rüger <[email protected]>
- Loading branch information
Showing
2 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env bash | ||
# exit immediately when a command fails | ||
set -e | ||
# only exit with zero if all commands of the pipeline exit successfully | ||
set -o pipefail | ||
# error on unset variables | ||
set -u | ||
|
||
[[ "$#" -eq 1 ]] || echo "One argument required, $# provided." | ||
|
||
REF_CURRENT="$(git rev-parse --abbrev-ref HEAD)" | ||
REF_TO_COMPARE=$1 | ||
|
||
RESULT_CURRENT="$(mktemp)-${REF_CURRENT}" | ||
RESULT_TO_COMPARE="$(mktemp)-${REF_TO_COMPARE}" | ||
|
||
echo "" | ||
echo "### Testing ${REF_CURRENT}" | ||
|
||
go test -benchmem -run=NONE -bench=. ./... | tee "${RESULT_CURRENT}" | ||
|
||
echo "" | ||
echo "### Done testing ${REF_CURRENT}" | ||
|
||
echo "" | ||
echo "### Testing ${REF_TO_COMPARE}" | ||
|
||
git checkout "${REF_TO_COMPARE}" | ||
|
||
go test -benchmem -run=NONE -bench=. ./... | tee "${RESULT_TO_COMPARE}" | ||
|
||
echo "" | ||
echo "### Done testing ${REF_TO_COMPARE}" | ||
|
||
git checkout - | ||
|
||
echo "" | ||
echo "### Result" | ||
echo "old=${REF_TO_COMPARE} new=${REF_CURRENT}" | ||
|
||
benchstat "${RESULT_TO_COMPARE}" "${RESULT_CURRENT}" |