alamb commented on code in PR #11557:
URL: https://github.com/apache/arrow-rs/pull/11557#discussion_r4275538057
##########
parquet/benches/row_selector_boolean_buffer.rs:
##########
@@ -78,62 +84,51 @@ fn boolean_array(mask: &BooleanBuffer) -> BooleanArray {
fn criterion_benchmark(c: &mut Criterion) {
let patterns = build_patterns();
+ benchmark_selections(c, "construction", &patterns, |selection| selection);
- let mut construction =
c.benchmark_group("row_selector_boolean_buffer/construction");
- for case in &patterns {
- construction.bench_with_input(
- BenchmarkId::new("from_filters", case.label()),
- &case.mask,
- |b, mask| {
- b.iter(|| {
- let array = boolean_array(mask);
- let selection = RowSelection::from_filters(&[array]);
- hint::black_box(selection);
- })
- },
- );
+ let parquet_data = write_parquet_file(TOTAL_ROWS);
+ benchmark_selections(c, "reader", &patterns, |selection| {
+ read_rows(&parquet_data, selection)
+ });
- construction.bench_with_input(
- BenchmarkId::new("from_boolean_buffer", case.label()),
- &case.mask,
- |b, mask| {
- b.iter(|| {
- let selection =
RowSelection::from_boolean_buffer(mask.clone());
- hint::black_box(selection);
- })
- },
- );
- }
- construction.finish();
+ let runtime = tokio::runtime::Builder::new_current_thread()
+ .build()
+ .unwrap();
+ benchmark_selections(c, "reader_async", &patterns, |selection| {
+ runtime.block_on(read_rows_async(&parquet_data, selection))
+ });
+}
- let parquet_data = write_parquet_file(TOTAL_ROWS);
- let mut reader = c.benchmark_group("row_selector_boolean_buffer/reader");
- for case in &patterns {
- reader.bench_with_input(
+fn benchmark_selections<T>(
Review Comment:
I think it would help to have a comment that explained what `run` represents
and what is timed --
so like the fact that the mask construction is also included in the time,
along with whatever `run` does
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]