Skip to content
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
27 changes: 25 additions & 2 deletions benches/uint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ fn bench_division(c: &mut Criterion) {
)
});

group.bench_function("div/rem_vartime, U256/U128, full size", |b| {
b.iter_batched(
|| {
let x = U256::random(&mut OsRng);
let y: U256 = (U128::MAX, U128::ZERO).into();
(x, NonZero::new(y).unwrap())
},
|(x, y)| black_box(x.div_rem_vartime(&y)),
BatchSize::SmallInput,
)
});

group.bench_function("rem, U256/U128, full size", |b| {
b.iter_batched(
|| {
Expand All @@ -35,15 +47,26 @@ fn bench_division(c: &mut Criterion) {
b.iter_batched(
|| {
let x = U256::random(&mut OsRng);
let y_half = U128::random(&mut OsRng);
let y: U256 = (y_half, U128::ZERO).into();
let y: U256 = (U128::MAX, U128::ZERO).into();
(x, NonZero::new(y).unwrap())
},
|(x, y)| black_box(x.rem_vartime(&y)),
BatchSize::SmallInput,
)
});

group.bench_function("rem_wide_vartime, U256", |b| {
b.iter_batched(
|| {
let (x_lo, x_hi) = (U256::random(&mut OsRng), U256::random(&mut OsRng));
let y: U256 = (U128::MAX, U128::ZERO).into();
(x_lo, x_hi, NonZero::new(y).unwrap())
},
|(x_lo, x_hi, y)| black_box(Uint::rem_wide_vartime((x_lo, x_hi), &y)),
BatchSize::SmallInput,
)
});

group.bench_function("div/rem, U256/Limb, full size", |b| {
b.iter_batched(
|| {
Expand Down
Loading