Jefffrey commented on code in PR #10447:
URL: https://github.com/apache/arrow-rs/pull/10447#discussion_r3674102436


##########
arrow-ipc/benches/ipc_writer.rs:
##########
@@ -60,6 +64,36 @@ fn criterion_benchmark(c: &mut Criterion) {
         })
     });
 
+    group.bench_function("StreamEncoder/encode_10", |b| {
+        let batch = create_batch(8192, true);
+        b.iter(move || {
+            let mut encoder = 
StreamEncoder::try_new(batch.schema().as_ref()).unwrap();
+            let mut encoded_len = 0;
+            for _ in 0..10 {
+                encoded_len += 
encoded_buffers_len(encoder.encode(&batch).unwrap());
+            }
+            encoded_len += encoded_buffers_len(encoder.finish().unwrap());
+            black_box(encoded_len);
+        })
+    });
+
+    group.bench_function("StreamEncoder/encode_10/zstd", |b| {
+        let batch = create_batch(8192, true);
+        b.iter(move || {
+            let options = IpcWriteOptions::default()
+                .try_with_compression(Some(CompressionType::ZSTD))
+                .unwrap();
+            let mut encoder =
+                StreamEncoder::try_new_with_options(batch.schema().as_ref(), 
options).unwrap();
+            let mut encoded_len = 0;
+            for _ in 0..10 {
+                encoded_len += 
encoded_buffers_len(encoder.encode(&batch).unwrap());
+            }
+            encoded_len += encoded_buffers_len(encoder.finish().unwrap());
+            black_box(encoded_len);

Review Comment:
   so do we still need to accumulate the lengths like this, or black boxing the 
encode methods is already sufficient?



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