Skip to content

Merge pull request #3362 from cbeck88/try-to-improve-developer-iterat… #974

Merge pull request #3362 from cbeck88/try-to-improve-developer-iterat…

Merge pull request #3362 from cbeck88/try-to-improve-developer-iterat… #974

Workflow file for this run

name: Run snarkVM Benchmarks
on:
push:
branches:
- 'staging'
- 'fix/benchmark-ci'
workflow_dispatch:
jobs:
# Run benchmarks and stores the output to a file
benchmark:
name: Benchmark
# Pin to a specific image to reduce runner-image drift between comparisons.
runs-on: ubuntu-24.04
permissions:
contents: write
env:
# Override .cargo/config.toml's target-cpu=native. Cached proc-macros and
# build scripts compiled for one runner CPU SIGILL on another. Keep lld.
RUSTFLAGS: "-C link-arg=-fuse-ld=lld"
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install required Debian pacakges
run: sudo apt install -y lld
- uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
# Bump the key suffix when RUSTFLAGS change to invalidate poisoned caches.
key: ${{ runner.os }}-cargo-bench-v2-${{ hashFiles('**/Cargo.lock') }}
- name: Benchmark algorithms
run: |
set -o pipefail
cd algorithms
cargo bench --locked --bench variable_base -- --output-format bencher | tee -a ../output.txt
cargo bench --locked --bench poseidon_sponge -- --output-format bencher | tee -a ../output.txt
# Skip varuna: downloads multi-GB USRS params and regularly OOMs/kills the runner.
cd ..
- name: Benchmark circuit/environment
run: |
set -o pipefail
cd circuit/environment
cargo bench --locked --bench linear_combination -- --output-format bencher | tee -a ../../output.txt
cd ../..
- name: Benchmark console/account
run: |
set -o pipefail
cd console/account
cargo bench --locked --bench account -- --output-format bencher | tee -a ../../output.txt
cd ../..
- name: Benchmark console/algorithms
run: |
set -o pipefail
cd console/algorithms
cargo bench --locked --bench poseidon -- --output-format bencher | tee -a ../../output.txt
cargo bench --locked --bench elligator2 -- --output-format bencher | tee -a ../../output.txt
cd ../..
- name: Benchmark console/collections
run: |
set -o pipefail
cd console/collections
cargo bench --locked --bench merkle_tree -- --output-format bencher | tee -a ../../output.txt
cd ../..
- name: Benchmark console/types
run: |
set -o pipefail
cd console/types
cargo bench --locked --bench group -- --output-format bencher | tee -a ../../output.txt
cd ../..
- name: Benchmark curves
run: |
set -o pipefail
cd curves
cargo bench --locked --bench curves -- --output-format bencher | tee -a ../output.txt
cd ..
- name: Benchmark ledger (block)
run: |
set -o pipefail
cargo bench --package=snarkvm-ledger --bench block --features=rocks,test-helpers,test -- --output-format bencher | tee -a output.txt
- name: Benchmark ledger (dag)
run: |
set -o pipefail
cargo bench --package=snarkvm-ledger --bench dag --features=test-helpers -- --output-format bencher | tee -a output.txt
- name: Benchmark ledger (transaction)
run: |
set -o pipefail
cargo bench --package=snarkvm-ledger --bench transaction -- --output-format bencher | tee -a output.txt
- name: Benchmark ledger (store)
run: |
set -o pipefail
cargo bench --package=snarkvm-ledger --bench store --features=rocks,test-helpers -- --output-format bencher | tee -a output.txt
- name: Benchmark ledger/puzzle
run: |
set -o pipefail
cargo bench --package=snarkvm-ledger-puzzle --bench puzzle --features=setup -- --output-format bencher | tee -a output.txt
# Clean benchmark output to remove unnecessary lines
- name: Clean benchmark output
run: |
sed -n -i '/bench:/p' output.txt
# Download previous benchmark result from cache (if exists)
- name: Download previous benchmark data
uses: actions/cache@v4
with:
path: ./cache
key: ${{ runner.os }}-benchmark
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: snarkVM Benchmarks
tool: 'cargo'
output-file-path: output.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
alert-threshold: '150%'
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: '@vicsn'
auto-push: true
# Enable Job Summary for PRs
summary-always: true