Skip to content

Benchmarks

Benchmarks #9

Workflow file for this run

name: Benchmarks
on:
workflow_dispatch: {}
schedule:
- cron: "0 6 * * 1"
jobs:
bench:
name: cargo bench (nightly)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust (nightly)
uses: dtolnay/rust-toolchain@nightly
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Show toolchain
run: |
rustc -V
cargo -V
- name: Run benchmark
env:
RUSTFLAGS: "-C target-cpu=native"
run: |
cargo bench --features "std benchmark"
- name: Compare benchmark vs disabled (example)
run: |
set -e
echo "Running zero_overhead example with disabled mode (no-default-features)"
cargo run --release --example zero_overhead --no-default-features > disabled.txt
echo "Running overhead_compare example with benchmark mode (std+benchmark)"
cargo run --release --example overhead_compare --no-default-features --features "std benchmark" > benchmark.txt
echo "--- disabled.txt" && cat disabled.txt
echo "--- benchmark.txt" && cat benchmark.txt
- name: Upload compare artifacts
uses: actions/upload-artifact@v4
with:
name: overhead-compare
path: |
disabled.txt
benchmark.txt