Skip to content

Commit

Permalink
Don't bench seahash and highwayhash when plotting
Browse files Browse the repository at this point in the history
  • Loading branch information
ogxd committed Nov 14, 2024
1 parent 22ecdb8 commit 74d7a21
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
25 changes: 14 additions & 11 deletions benches/throughput/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,27 @@ fn main() {
fnv_hasher.finish()
});

// HighwayHash
benchmark(processor.as_mut(), slice, "HighwayHash", |data: &[u8], _: i32| -> u64 {
use highway::{HighwayHasher, HighwayHash};
HighwayHasher::default().hash64(data)
});

// SeaHash
benchmark(processor.as_mut(), slice, "SeaHash", |data: &[u8], seed: u64| -> u64 {
seahash::hash_seeded(data, seed, 0, 0, 0)
});

// MetroHash
benchmark(processor.as_mut(), slice, "Metrohash", |data: &[u8], seed: i32| -> u64 {
let mut metrohash_hasher = metrohash::MetroHash64::with_seed(seed as u64);
metrohash_hasher.write(data);
metrohash_hasher.finish()
});

// Don't benchmark theses when plotting because they're too slow resulting in the Y-axis too zoomed-out
if cfg!(not(feature = "bench-plot")) {
// HighwayHash
benchmark(processor.as_mut(), slice, "HighwayHash", |data: &[u8], _: i32| -> u64 {
use highway::{HighwayHasher, HighwayHash};
HighwayHasher::default().hash64(data)
});

// SeaHash
benchmark(processor.as_mut(), slice, "SeaHash", |data: &[u8], seed: u64| -> u64 {
seahash::hash_seeded(data, seed, 0, 0, 0)
});
}

processor.finish();

// Free benchmark data
Expand Down
4 changes: 3 additions & 1 deletion benches/throughput/result_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ impl ResultProcessor for OutputPlot {

chart
.configure_mesh()
.max_light_lines(1)
.x_max_light_lines(1)
.y_max_light_lines(2)
.y_labels(10)
.x_desc("Input Size (bytes)")
.y_desc("Throughput (MiB/s)")
.draw().unwrap();
Expand Down

0 comments on commit 74d7a21

Please sign in to comment.