Skip to content

Commit

Permalink
Add support for Codspeed performance testing (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
bifurcation authored May 31, 2024
1 parent 221f217 commit bcfd143
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 11 deletions.
20 changes: 19 additions & 1 deletion .github/workflows/ml-kem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- "Cargo.*"
push:
branches: master
workflow-dispatch:

defaults:
run:
Expand All @@ -21,7 +22,7 @@ jobs:
set-msrv:
uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master
with:
msrv: 1.74.0
msrv: 1.76.0

no_std:
needs: set-msrv
Expand Down Expand Up @@ -69,6 +70,23 @@ jobs:
- run: cargo test
- run: cargo test --all-features

bench:
needs: set-msrv
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: RustCrypto/actions/cargo-cache@master
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- run: cargo install cargo-codspeed
- run: cargo codspeed build
- name: Run benchmarks
uses: CodSpeedHQ/action@v2
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: cargo codspeed run

cross:
needs: set-msrv
strategy:
Expand Down
123 changes: 114 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ml-kem/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ hex = "0.4.3"
hex-literal = "0.4.1"
rand = "0.8.5"
crypto-common = { version = "0.1.6", features = ["rand_core"] }
codspeed-criterion-compat = "2.6.0"

[[bench]]
name = "mlkem"
Expand Down
2 changes: 1 addition & 1 deletion ml-kem/benches/mlkem.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use ::kem::{Decapsulate, Encapsulate};
use criterion::{criterion_group, criterion_main, Criterion};
use codspeed_criterion_compat::{criterion_group, criterion_main, Criterion};
use crypto_common::rand_core::CryptoRngCore;
use hybrid_array::{Array, ArraySize};
use ml_kem::*;
Expand Down

0 comments on commit bcfd143

Please sign in to comment.