Phoenix500526 commented on code in PR #10447:
URL: https://github.com/apache/arrow-rs/pull/10447#discussion_r3682829819
##########
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:
Yeah, that makes sense. Once the encoded buffers are passed through
`black_box`, the length accumulation is redundant and adds extra work to the
benchmark. I’ll simplify this to black-box the `encode` / `finish` results
directly.
--
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]