Benchmarks #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 example with disabled mode (no-default-features)" | |
| cargo run --release --example overhead_compare --no-default-features > disabled.txt | |
| echo "Running 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 |