Skip to content

Merge pull request #3373 from cbeck88/fix/restrictions-doctests #979

Merge pull request #3373 from cbeck88/fix/restrictions-doctests

Merge pull request #3373 from cbeck88/fix/restrictions-doctests #979

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
# RocksDB benches need libclang (via bindgen); match CircleCI rocks deps.
- name: Install required Debian packages
run: |
DEBIAN_FRONTEND=noninteractive sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y --no-install-recommends \
clang libclang-dev llvm-dev llvm lld pkg-config xz-utils make libssl-dev
- 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 --sample-size 10 --measurement-time 2 | 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 --sample-size 10 --measurement-time 2 | 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
# Skip store/advance: require a pre-generated `test-ledger/` fixture
# (see `snarkvm-testchain-generator --no-ledger`).
- 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: '200%'
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: '@vicsn'
auto-push: true
# Enable Job Summary for PRs
summary-always: true