This repository was archived by the owner on May 5, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
69 lines (57 loc) · 1.96 KB
/
benchmark.yml
File metadata and controls
69 lines (57 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Benchmark CI with Statistical Analysis
# Runs benchmarks with reproducible seeds and reports confidence intervals
name: Benchmark
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
PRESENTAR_BENCH_SEED: 12345
CRITERION_DEBUG: 0
jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-action@stable
with:
components: rustfmt, clippy
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-bench-${{ hashFiles('**/Cargo.lock') }}
- name: Run benchmarks
run: |
cargo criterion --message-format json > benchmark_results.json
- name: Generate statistics report
run: |
echo "## Benchmark Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Benchmark | Mean | 95% CI | Samples |" >> $GITHUB_STEP_SUMMARY
echo "|-----------|------|--------|---------|" >> $GITHUB_STEP_SUMMARY
# Parse Criterion JSON output
jq -r '.[] | select(.reason == "benchmark-complete") |
"| \(.id) | \(.mean.estimate | . / 1e6 | round)ms | [\(.mean.lower_bound | . / 1e6 | round)ms, \(.mean.upper_bound | . / 1e6 | round)ms] | \(.sample_count) |"' \
benchmark_results.json >> $GITHUB_STEP_SUMMARY || echo "No benchmark data"
- name: Check for regressions
run: |
# Compare against baseline if it exists
if [ -f data/benchmarks/baselines/latest.json ]; then
echo "Checking for performance regressions..."
cargo criterion --baseline latest || true
fi
- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmark-results
path: |
benchmark_results.json
target/criterion/