-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (43 loc) · 1.42 KB
/
bench.yml
File metadata and controls
51 lines (43 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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