Skip to content

Commit f042c40

Browse files
committed
Add sqrt benchmark
1 parent 8f46be0 commit f042c40

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

benches/uint.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,25 @@ fn bench_inv_mod(c: &mut Criterion) {
208208
group.finish();
209209
}
210210

211-
criterion_group!(benches, bench_shl, bench_shr, bench_division, bench_inv_mod);
211+
fn bench_sqrt(c: &mut Criterion) {
212+
let mut group = c.benchmark_group("sqrt");
213+
214+
group.bench_function("sqrt, U256", |b| {
215+
b.iter_batched(
216+
|| U256::random(&mut OsRng),
217+
|x| x.sqrt(),
218+
BatchSize::SmallInput,
219+
)
220+
});
221+
}
222+
223+
criterion_group!(
224+
benches,
225+
bench_shl,
226+
bench_shr,
227+
bench_division,
228+
bench_inv_mod,
229+
bench_sqrt
230+
);
212231

213232
criterion_main!(benches);

0 commit comments

Comments
 (0)