Skip to content

Commit

Permalink
Update benchmark.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelDkhn committed Jan 2, 2025
1 parent 13b56f5 commit ef0b084
Showing 1 changed file with 36 additions and 20 deletions.
56 changes: 36 additions & 20 deletions .github/workflows/benchmark.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# .github/workflows/benchmark.yml
name: Benchmarks

on:
push:
branches: [stwo-backend]
pull_request:
branches: [stwo-backend]
branches: [stwo]

env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "--cfg tokio_unstable" # Enable unstable features if needed
RUSTFLAGS: "--cfg tokio_unstable"

jobs:
benchmark:
Expand All @@ -17,7 +18,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Get full history for benchmarking across commits
fetch-depth: 0

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
Expand All @@ -40,12 +41,41 @@ jobs:
- name: Install required packages
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev
sudo apt-get install -y pkg-config libssl-dev jq
- name: Run benchmarks
- name: Run benchmarks and format output
run: |
cargo +nightly-2024-01-04 bench --bench tensor_ops -- --output-format criterion | tee output.txt
# Run benchmarks and save full output
cargo +nightly-2024-01-04 bench --bench tensor_ops -- --output-format json | tee criterion_output.json
# Create a JSON file in the format expected by github-action-benchmark
echo '[' > benchmark_output.json
# Parse Criterion JSON output and convert to github-action-benchmark format
jq -r '.[]| select(.typical != null) | {
name: .full_id,
value: .typical.estimate,
unit: "ns",
range: (.typical.upper_bound - .typical.lower_bound)
}' criterion_output.json | jq -s '.' > benchmark_output.json
echo ']' >> benchmark_output.json
- name: Store benchmark results
uses: benchmark-action/github-action-benchmark@v1
with:
name: Rust Circuit Benchmarks
tool: "customSmallerIsBetter"
output-file-path: benchmark_output.json
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
alert-threshold: "150%"
comment-on-alert: true
fail-on-alert: true
gh-pages-branch: gh-pages
benchmark-data-dir-path: dev/bench/data

# Deploy the Criterion HTML report
- name: Create benchmark summary
run: |
mkdir -p target/criterion/summary
Expand Down Expand Up @@ -148,20 +178,6 @@ jobs:
</html>
EOL
- name: Store benchmark results
uses: benchmark-action/github-action-benchmark@v1
with:
name: Rust Circuit Benchmarks
tool: "criterion"
output-file-path: output.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
alert-threshold: "150%"
comment-on-alert: true
fail-on-alert: true
gh-pages-branch: gh-pages
benchmark-data-dir-path: dev/bench/data

- name: Deploy benchmark results
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
Expand Down

0 comments on commit ef0b084

Please sign in to comment.