diff --git a/benches/bench.rs b/benches/bench.rs index fcec0e2..d4f22ed 100644 --- a/benches/bench.rs +++ b/benches/bench.rs @@ -1,7 +1,7 @@ use core::num::NonZeroU32; use criterion::{criterion_group, criterion_main, BatchSize, Criterion}; -use crypto_bigint::{nlimbs, Integer, Odd, RandomBits, Uint, U1024, U128, U256}; +use crypto_bigint::{nlimbs, BoxedUint, Integer, Odd, RandomBits, Uint, U1024, U128, U256}; use rand_chacha::ChaCha8Rng; use rand_core::{CryptoRngCore, OsRng, SeedableRng}; @@ -238,6 +238,17 @@ fn bench_presets(c: &mut Criterion) { b.iter(|| generate_safe_prime_with_rng::(&mut rng, 1024, 1024)) }); + let mut rng = make_rng(); + group.bench_function("(Boxed128) Random safe prime", |b| { + b.iter(|| generate_safe_prime_with_rng::(&mut rng, 128, 128)) + }); + + group.sample_size(20); + let mut rng = make_rng(); + group.bench_function("(Boxed1024) Random safe prime", |b| { + b.iter(|| generate_safe_prime_with_rng::(&mut rng, 1024, 1024)) + }); + group.finish(); // A separate group for bounded tests, to make it easier to run them separately.