Skip to content

Commit b814754

Browse files
authored
bench hash
Signed-off-by: GitHub <[email protected]>
1 parent 91e4f78 commit b814754

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

benchmarks/benches/criterion.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ pub fn criterion_benchmark(c: &mut Criterion) {
3636
});
3737
});
3838

39-
4039
c.bench_function("hash", |b| {
40+
use std::hash::{DefaultHasher, Hash, Hasher};
4141
b.iter(|| {
4242
for i in &valid_values_f32 {
43-
let hash = i.hash();
44-
black_box(hash);
43+
let mut s = DefaultHasher::new();
44+
let hash = i.hash(&mut s);
45+
black_box(s.finish());
4546
}
4647
});
4748
});

0 commit comments

Comments
 (0)