Rich-T-kid commented on code in PR #10808:
URL: https://github.com/apache/arrow-rs/pull/10808#discussion_r3884401534


##########
arrow/benches/coalesce_kernels.rs:
##########
@@ -645,6 +738,78 @@ fn take_streams(
     }
 }
 
+struct SliceBenchmarkBuilder<'a> {
+    c: &'a mut Criterion,
+    name: &'a str,
+    large_batch_rows: usize,
+    chunk_rows: usize,
+    null_density: f32,
+    max_string_len: usize,
+    schema: &'a SchemaRef,
+}
+
+impl SliceBenchmarkBuilder<'_> {
+    fn build(self) {
+        let Self {
+            c,
+            name,
+            large_batch_rows,
+            chunk_rows,
+            null_density,
+            max_string_len,
+            schema,
+        } = self;
+
+        let source_batches: Arc<[RecordBatch]> = (0..10_u64)
+            .map(|seed| {
+                let columns = schema
+                    .fields()
+                    .iter()
+                    .map(|field| {
+                        DataStreamBuilder::new(Arc::clone(schema))
+                            .with_batch_size(large_batch_rows)
+                            .with_null_density(null_density)
+                            .with_max_string_len(max_string_len)
+                            .create_input_array(field, seed)
+                    })
+                    .collect::<Vec<_>>();
+                RecordBatch::try_new(Arc::clone(schema), columns).unwrap()
+            })
+            .collect::<Vec<_>>()
+            .into();
+
+        let id = format!(
+            "slice: {name}, source: {large_batch_rows}, chunk: {chunk_rows}, 
nulls: {null_density}"
+        );
+        c.bench_function(&id, |b| {
+            b.iter(|| {
+                push_slices(Arc::clone(&source_batches), chunk_rows, 
Arc::clone(schema));
+            })
+        });
+    }
+}
+
+/// Push slices of the source batches through a `BatchCoalescer`.

Review Comment:
   nit: remove comment.



-- 
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]

Reply via email to