Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: Add criterion benchmark for xxhash64 function #560

Merged
merged 5 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions core/benches/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
mod common;

use arrow_array::ArrayRef;
use comet::execution::datafusion::spark_hash::create_xxhash64_hashes;
use comet::execution::kernels::hash;
use common::*;
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
Expand Down Expand Up @@ -95,6 +96,16 @@ fn criterion_benchmark(c: &mut Criterion) {
});
},
);
group.bench_function(BenchmarkId::new("xxhash64", BATCH_SIZE), |b| {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @andygrove. Could we extend this PR a bit and add a murmur3 hash benchmark as well?

In that way, I think we can get a sense of how slow xxhash64 is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

let input = vec![a3.clone(), a4.clone()];
let mut dst = vec![0; BATCH_SIZE];

b.iter(|| {
for _ in 0..NUM_ITER {
create_xxhash64_hashes(&input, &mut dst).unwrap();
}
});
});
}

fn config() -> Criterion {
Expand Down
2 changes: 1 addition & 1 deletion core/src/execution/datafusion/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ pub mod expressions;
mod operators;
pub mod planner;
pub mod shuffle_writer;
mod spark_hash;
pub mod spark_hash;
mod util;
2 changes: 1 addition & 1 deletion core/src/execution/datafusion/spark_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ pub(crate) fn create_murmur3_hashes<'a>(
///
/// The number of rows to hash is determined by `hashes_buffer.len()`.
/// `hashes_buffer` should be pre-sized appropriately
pub(crate) fn create_xxhash64_hashes<'a>(
pub fn create_xxhash64_hashes<'a>(
arrays: &[ArrayRef],
hashes_buffer: &'a mut [u64],
) -> Result<&'a mut [u64]> {
Expand Down
Loading