Skip to content

Commit

Permalink
add nightly benchmark
Browse files Browse the repository at this point in the history
This should ensure we don't creep little percentages over the course of
multiple commits into main, compared to the last release branch.

Signed-off-by: Thomas Jungblut <[email protected]>
  • Loading branch information
tjungblu committed Jul 9, 2024
1 parent 46d9b10 commit 278185a
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/benchmark-releases.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: Benchmarks nightly between last release and current main on AMD64
permissions: read-all
on:
schedule:
- cron: '10 5 * * *' # runs every day at 05:10 UTC
# workflow_dispatch enables manual testing of this job by maintainers
workflow_dispatch:
jobs:
benchmark-nightly:
runs-on: ubuntu-latest-8-cores
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
fetch-depth: 0
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: ${{ steps.goversion.outputs.goversion }}
- name: Run Benchmarks
run: |
BENCHSTAT_OUTPUT_FILE=result.txt make test-benchmark-compare REF=release-1.3
- run: |
echo "\`\`\`" >> "$GITHUB_STEP_SUMMARY"
cat result.txt >> "$GITHUB_STEP_SUMMARY"
echo "\`\`\`" >> "$GITHUB_STEP_SUMMARY"
cat <<EOL >> "$GITHUB_STEP_SUMMARY"
<hr />
The table shows the median and 90% confidence interval (CI) summaries for each benchmark comparing the HEAD (current main) and the BASE (release-1.3 branch), and an A/B comparison under "vs base". The last column shows the statistical p-value with ten runs (n=10).
The last row has the Geometric Mean (geomean) for the given rows in the table.
Refer to [benchstat's documentation](https://pkg.go.dev/golang.org/x/perf/cmd/benchstat) for more help.
EOL
- name: Validate results under acceptable limit
run: |
export MAX_ACCEPTABLE_DIFFERENCE=5
while IFS= read -r line; do
# Get fourth value, which is the comparison with the base.
value="$(echo "$line" | awk '{print $4}')"
if [[ "$value" = +* ]] || [[ "$value" = -* ]]; then
if (( $(echo "${value//[^0-9.]/}"'>'"$MAX_ACCEPTABLE_DIFFERENCE" | bc -l) )); then
echo "::error::$value is above the maximum acceptable difference ($MAX_ACCEPTABLE_DIFFERENCE)"
exit 1
fi
fi
done < <(grep geomean result.txt)

0 comments on commit 278185a

Please sign in to comment.