Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f56adcd
Add benchmark with improvement
adam-fowler Apr 8, 2025
6112808
Look at exit status of benchmark step
adam-fowler Apr 8, 2025
bbdcf94
See exit status, add section for significant differences
adam-fowler Apr 8, 2025
486dfeb
Add performance regression
adam-fowler Apr 8, 2025
bbfb451
print result even when successful
adam-fowler Apr 8, 2025
e3b7fbd
trying to get a regression
adam-fowler Apr 9, 2025
6e7c8b5
Increase malllocs
adam-fowler Apr 15, 2025
79cb6d2
Change benchmark comment
adam-fowler Apr 16, 2025
7beb4e7
minor edits
adam-fowler Apr 16, 2025
75cfdbf
Try using set +e instead of continue-on-errors
adam-fowler Apr 16, 2025
fb76bff
Remove performance differences
adam-fowler Apr 16, 2025
2165453
Check improved
adam-fowler Apr 16, 2025
88ffecc
Report benchmark differences, don't return error
adam-fowler Apr 17, 2025
a974f3c
Revert temporary changes
adam-fowler Apr 17, 2025
a78674e
Parse error message instead of return code
adam-fowler Apr 17, 2025
d6bfc07
Test improvement
adam-fowler Apr 17, 2025
f4528cb
Fix cut
adam-fowler Apr 17, 2025
d172cbe
one more time
adam-fowler Apr 17, 2025
58659da
Add echo -e
adam-fowler Apr 17, 2025
f648d0e
Moving stuff
adam-fowler Apr 17, 2025
68353c7
Redirect stderr to separate variable
adam-fowler Apr 18, 2025
e9b6f9a
another redirect attempt
adam-fowler Apr 18, 2025
f9f85f7
Run baseline check twice
adam-fowler Apr 18, 2025
f075e00
with output
adam-fowler Apr 18, 2025
ebeb2b4
Disable benchmarking to speed up check
adam-fowler Apr 18, 2025
8e900d7
Run benchmarks
adam-fowler Apr 18, 2025
2847c55
Test no improvement
adam-fowler Apr 18, 2025
8a4b9b3
Test regression
adam-fowler Apr 18, 2025
1ca4e1e
Try with continue-on-error
adam-fowler Apr 18, 2025
66a378f
Revert ValkeyBenchmarks changes
adam-fowler Apr 18, 2025
26fb3e8
Move ci.yml back in workflows
adam-fowler Apr 18, 2025
1aff2ba
Exit env.exitStatus
adam-fowler Apr 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 41 additions & 20 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,34 +67,55 @@ jobs:
run: |
echo '## Summary' >> $GITHUB_STEP_SUMMARY
echo $(date) >> $GITHUB_STEP_SUMMARY
echo "exitStatus=1" >> $GITHUB_ENV
# if we had access to fd 3 we could do this in one call eg { var=$(cmd 3>&2 2>&1 1>&3); } 2>&1
# but unfortunately we don't so we have to run the baseline check twice once to extract stdout
# and once to extract stderr
BENCHMARK_STDERR=$(swift package benchmark baseline check main pull_request 2>&1)
swift package benchmark baseline check main pull_request --format markdown >> $GITHUB_STEP_SUMMARY
echo '---' >> $GITHUB_STEP_SUMMARY
swift package benchmark baseline compare main pull_request --no-progress --quiet --format markdown >> $GITHUB_STEP_SUMMARY
echo "exitStatus=0" >> $GITHUB_ENV
echo "exit-status=$?" >> $GITHUB_OUTPUT
echo "benchmark-error=$(echo -e "$BENCHMARK_STDERR" | grep -e "^error: .*" | tail -n 1 | cut -c 8-)" >> $GITHUB_OUTPUT
continue-on-error: true
- if: ${{ env.exitStatus == '0' }}
name: Pull request comment text success
id: prtestsuccess
- name: Pull request comment text
id: benchmark-comment
run: |
echo 'PRTEST<<EOF' >> $GITHUB_ENV
echo "[Pull request benchmark comparison [${{ matrix.os }}] with 'main' run at $(date -Iseconds)](https://github.com/adam-fowler/${{ github.event.repository.name }}/actions/runs/${{ github.run_id }})" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- if: ${{ env.exitStatus == '1' }}
name: Pull request comment text failure
id: prtestfailure
run: |
echo 'PRTEST<<EOF' >> $GITHUB_ENV
echo "[Pull request benchmark comparison [${{ matrix.os }}] with 'main' run at $(date -Iseconds)](https://github.com/adam-fowler/${{ github.event.repository.name }}/actions/runs/${{ github.run_id }})" >> $GITHUB_ENV
echo "_Pull request had performance regressions_" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
echo "[Pull request benchmark comparison [${{ matrix.os }}] with 'main' run at $(date -Iseconds)](https://github.com/adam-fowler/${{ github.event.repository.name }}/actions/runs/${{ github.run_id }})" >> comment.md

EXIT_CODE='${{steps.benchmark.outputs.exit-status}}'

case "${EXIT_CODE}" in
0)
echo "_Pull request no significant performance differences ✅_" >> comment.md
echo "exitStatus=0" >> $GITHUB_ENV
;;
*)
# Get error string from benchmark output
BENCHMARK_ERROR='${{steps.benchmark.outputs.benchmark-error}}'
case "${BENCHMARK_ERROR}" in
"benchmarkThresholdRegression")
echo "_Pull request has performance regressions ❌_" >> comment.md
echo "exitStatus=1" >> $GITHUB_ENV
;;
"benchmarkThresholdImprovement")
echo "_Pull request has performance improvements ✅_" >> comment.md
echo "exitStatus=0" >> $GITHUB_ENV
;;
*)
echo "_Benchmark comparison failed with error $BENCHMARK_ERROR ❌_" >> comment.md
echo "exitStatus=1" >> $GITHUB_ENV
;;
esac
;;
esac

echo '---' >> $GITHUB_STEP_SUMMARY
swift package benchmark baseline compare main pull_request --no-progress --quiet --format markdown >> $GITHUB_STEP_SUMMARY
- name: Comment PR
if: ${{ env.hasBenchmark == '1' }}
uses: thollander/actions-comment-pull-request@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
message: ${{ env.PRTEST }}
file-path: comment.md
comment-tag: benchmark
- name: Exit with correct status
run: |
exit ${{ env.exitStatus }}
exit ${{env.exitStatus}}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ DerivedData/
.netrc
.vscode
Package.resolved
.benchmarkBaselines/
.benchmarkBaselines/
.swift-version
4 changes: 2 additions & 2 deletions Benchmarks/ValkeyBenchmarks/ValkeyBenchmarks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ let benchmarks: @Sendable () -> Void = {
// There is no point comparing wallClock, cpuTotal or throughput on CI as they are too inconsistent
ProcessInfo.processInfo.environment["CI"] != nil
? [
.mallocCountTotal,
.instructions,
.mallocCountTotal,
]
: [
.wallClock,
.cpuTotal,
.instructions,
.mallocCountTotal,
.throughput,
.instructions,
]

var server: Channel?
Expand Down