mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-11-05 12:03:01 -05:00
Bumps [github.com/open-policy-agent/opa](https://github.com/open-policy-agent/opa) from 1.19.1 to 1.21.1. - [Release notes](https://github.com/open-policy-agent/opa/releases) - [Changelog](https://github.com/open-policy-agent/opa/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-policy-agent/opa/compare/v1.19.1...v1.21.1) --- updated-dependencies: - dependency-name: github.com/open-policy-agent/opa dependency-version: 1.20.2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
42 lines
875 B
Bash
42 lines
875 B
Bash
#!/bin/bash
|
|
#
|
|
# Compares the benchmarks of the current branch against a git revision:
|
|
#
|
|
# ./bench.sh v0.2.3 # all the benchmarks
|
|
# ./bench.sh master 'Match' # the ones matching a -bench regexp
|
|
#
|
|
# The results are written to *.bench files in the current directory and
|
|
# compared with benchstat (go install golang.org/x/perf/cmd/benchstat@latest).
|
|
|
|
set -eu
|
|
|
|
prev=$1
|
|
what=${2:-.}
|
|
curr=$(git rev-parse --abbrev-ref HEAD)
|
|
rnd=$(head -c4 </dev/urandom | xxd -p)
|
|
|
|
file() {
|
|
echo "$rnd-$1.bench" | tr "/" "_"
|
|
}
|
|
|
|
bench() {
|
|
local rev=$1
|
|
local out
|
|
out=$(file "$rev")
|
|
if [[ -e "$out" ]]; then
|
|
echo "Already exists $out"
|
|
return
|
|
fi
|
|
git checkout -q "$rev"
|
|
echo -n "Creating $out... "
|
|
go test ./... -run=none -benchmem -bench="$what" >"$out"
|
|
echo "OK"
|
|
git checkout -q "$curr"
|
|
sleep 5
|
|
}
|
|
|
|
bench "$prev"
|
|
bench "$curr"
|
|
|
|
benchstat "$(file "$prev")" "$(file "$curr")"
|