Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ML-DSA benchmarks #573

Merged
merged 3 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/mldsa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,9 @@ jobs:
run: |
cargo clean
cargo test --verbose --release $RUST_TARGET_FLAG

# Benchmarks
- name: 🔨 Build Benchmarks
run: |
cargo clean
cargo bench --no-run
7 changes: 4 additions & 3 deletions libcrux-ml-dsa/benches/bench_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ macro_rules! bench {
// Warmup
for _ in 0..bench_utils::WARMUP_ITERATIONS {
let input = $setup($input);
$routine(input);
let _ = $routine(input);
}

// Benchmark
for _ in 0..bench_utils::ITERATIONS {
let input = $setup($input);

let start = std::time::Instant::now();
core::hint::black_box($routine(input));
let _ = core::hint::black_box($routine(input));
let end = std::time::Instant::now();

time += end.duration_since(start);
Expand Down Expand Up @@ -116,7 +116,8 @@ macro_rules! bench_group_libcrux {
let signing_randomness: [u8; SIGNING_RANDOMNESS_SIZE] = bench_utils::random_array();
let message = bench_utils::random_array::<1023>();
let keypair = p::generate_key_pair(key_generation_seed);
let signature = p::sign(&keypair.signing_key, &message, signing_randomness);
let signature =
p::sign(&keypair.signing_key, &message, signing_randomness).unwrap();
(keypair, message, signature)
},
|(keypair, message, signature): ($keypair_t, [u8; 1023], $signature_t)| {
Expand Down
2 changes: 1 addition & 1 deletion libcrux-ml-dsa/benches/ml-dsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub fn comparisons_verification(c: &mut Criterion) {
let keypair = ml_dsa_65::generate_key_pair(randomness);

rng.fill_bytes(&mut randomness);
let signature = ml_dsa_65::sign(&keypair.signing_key, &message, randomness);
let signature = ml_dsa_65::sign(&keypair.signing_key, &message, randomness).unwrap();

group.bench_function("libcrux", move |b| {
b.iter(|| {
Expand Down
Loading