asubiotto commented on code in PR #12070:
URL: https://github.com/apache/arrow-rs/pull/12070#discussion_r4467131880


##########
arrow-ipc/benches/ipc_reader.rs:
##########
@@ -185,6 +188,47 @@ fn criterion_benchmark(c: &mut Criterion) {
             }
         })
     });
+
+    for (name, nested) in [("flat", false), ("nested", true)] {
+        let buffer = wide_dictionary_ipc_stream(1000, nested);
+        group.bench_function(format!("StreamReader/dictionaries_1000/{name}"), 
|b| {
+            b.iter(|| {
+                let mut reader = StreamReader::try_new(buffer.as_slice(), 
None).unwrap();
+                reader.next().unwrap().unwrap();
+                assert!(reader.next().is_none());
+            })
+        });
+    }
+}
+
+/// Return an IPC stream with one small record batch of `num_columns` 
dictionary columns, so the
+/// stream holds `num_columns` dictionary batches. With `nested`, each 
dictionary is a list item.
+fn wide_dictionary_ipc_stream(num_columns: usize, nested: bool) -> Vec<u8> {
+    let dictionary: ArrayRef = Arc::new(
+        ["a", "b", "a", "c"]
+            .into_iter()
+            .collect::<DictionaryArray<Int32Type>>(),
+    );
+    let column = if nested {
+        let item = Arc::new(Field::new("item", dictionary.data_type().clone(), 
true));
+        Arc::new(ListArray::new(
+            item,
+            OffsetBuffer::from_lengths([2, 2]),

Review Comment:
   Yes, the follow up PR cared more about the number of the columns than 
values. In the spirit of making this benchmark more generally useful I'm not 
building this with a builder that makes 1024 rows of 4 values each with  
varying distinctness for the inner dictionary.



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