Fix Benches (#1833)

This commit is contained in:
Dominik Maier 2024-02-05 17:19:23 +01:00 committed by GitHub
parent 99a70e5771
commit 7d9559b570
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 3 deletions

View File

@ -16,7 +16,7 @@ criterion = "0.5" # Benchmarking
ahash = { version = "0.8", default-features=false } # The hash function already used in hashbrown ahash = { version = "0.8", default-features=false } # The hash function already used in hashbrown
rustc-hash = { version = "1.1", default-features=false } # yet another hash rustc-hash = { version = "1.1", default-features=false } # yet another hash
xxhash-rust = { version = "0.8.5", features = ["xxh3"] } # xxh3 hashing for rust xxhash-rust = { version = "0.8.5", features = ["xxh3"] } # xxh3 hashing for rust
libafl_bolts = { path = "../../libafl_bolts", default-features=false } # libafl_bolts libafl_bolts = { path = "../../libafl_bolts", default-features=false, features = ["xxh3", "alloc"] } # libafl_bolts
[[bench]] [[bench]]
name = "rand_speeds" name = "rand_speeds"

View File

@ -22,14 +22,15 @@ fn criterion_benchmark(c: &mut Criterion) {
});*/ });*/
c.bench_function("ahash", |b| { c.bench_function("ahash", |b| {
b.iter(|| { b.iter(|| {
let mut hasher = ahash::RandomState::with_seeds(123, 456, 789, 123).build_hasher(); let mut hasher =
black_box(ahash::RandomState::with_seeds(123, 456, 789, 123).build_hasher());
hasher.write(black_box(&bench_vec)); hasher.write(black_box(&bench_vec));
hasher.finish(); hasher.finish();
}); });
}); });
c.bench_function("fxhash", |b| { c.bench_function("fxhash", |b| {
b.iter(|| { b.iter(|| {
let mut hasher = rustc_hash::FxHasher::default(); let mut hasher = black_box(rustc_hash::FxHasher::default());
hasher.write(black_box(&bench_vec)); hasher.write(black_box(&bench_vec));
hasher.finish(); hasher.finish();
}); });