dependabot[bot] 4dc5a8ed14
Update criterion requirement from 0.5.1 to 0.6.0 (#3251)
* Update criterion requirement from 0.5.1 to 0.6.0

Updates the requirements on [criterion](https://github.com/bheisler/criterion.rs) to permit the latest version.
- [Changelog](https://github.com/bheisler/criterion.rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/bheisler/criterion.rs/compare/0.5.1...0.6.0)

---
updated-dependencies:
- dependency-name: criterion
  dependency-version: 0.6.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* clippy

* undo / too modern

* clip

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Dominik Maier <dmnk@google.com>
2025-05-19 14:49:25 +02:00

29 lines
1.1 KiB
Rust

//! Compare the speed of rand implementations
use core::hint::black_box;
use criterion::{Criterion, criterion_group, criterion_main};
use libafl_bolts::rands::{
Lehmer64Rand, Rand, RomuDuoJrRand, RomuTrioRand, Sfc64Rand, XorShift64Rand,
Xoshiro256PlusPlusRand,
};
fn criterion_benchmark(c: &mut Criterion) {
let mut sfc64 = Sfc64Rand::with_seed(1);
let mut xorshift = XorShift64Rand::with_seed(1);
let mut xoshiro = Xoshiro256PlusPlusRand::with_seed(1);
let mut romu = RomuDuoJrRand::with_seed(1);
let mut lehmer = Lehmer64Rand::with_seed(1);
let mut romu_trio = RomuTrioRand::with_seed(1);
c.bench_function("sfc64", |b| b.iter(|| black_box(sfc64.next())));
c.bench_function("xorshift", |b| b.iter(|| black_box(xorshift.next())));
c.bench_function("xoshiro", |b| b.iter(|| black_box(xoshiro.next())));
c.bench_function("romu", |b| b.iter(|| black_box(romu.next())));
c.bench_function("romu_trio", |b| b.iter(|| black_box(romu_trio.next())));
c.bench_function("lehmer", |b| b.iter(|| black_box(lehmer.next())));
}
criterion_group!(benches, criterion_benchmark);
criterion_main!(benches);