From 7d9559b570a7042637f0abd4fcc409c67ed0696d Mon Sep 17 00:00:00 2001 From: Dominik Maier Date: Mon, 5 Feb 2024 17:19:23 +0100 Subject: [PATCH] Fix Benches (#1833) --- utils/libafl_benches/Cargo.toml | 2 +- utils/libafl_benches/benches/hash_speeds.rs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/libafl_benches/Cargo.toml b/utils/libafl_benches/Cargo.toml index cd5e8914f3..335b8979b2 100644 --- a/utils/libafl_benches/Cargo.toml +++ b/utils/libafl_benches/Cargo.toml @@ -16,7 +16,7 @@ criterion = "0.5" # Benchmarking 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 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]] name = "rand_speeds" diff --git a/utils/libafl_benches/benches/hash_speeds.rs b/utils/libafl_benches/benches/hash_speeds.rs index 35f61b3fcc..e1aee1cab2 100644 --- a/utils/libafl_benches/benches/hash_speeds.rs +++ b/utils/libafl_benches/benches/hash_speeds.rs @@ -22,14 +22,15 @@ fn criterion_benchmark(c: &mut Criterion) { });*/ c.bench_function("ahash", |b| { 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.finish(); }); }); c.bench_function("fxhash", |b| { 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.finish(); });