gabotechs commented on code in PR #12083:
URL: https://github.com/apache/arrow-rs/pull/12083#discussion_r4482262320
##########
arrow-ipc/benches/ipc_writer.rs:
##########
@@ -81,6 +81,34 @@ fn criterion_benchmark(c: &mut Criterion) {
})
});
+ for (rows, threads) in [(8192, 1), (65536, 1), (8192, 16), (65536, 16)] {
+ group.bench_function(
+
format!("StreamEncoder/encode_10/lz4/rows={rows}/threads={threads}"),
+ |b| {
+ let batch = create_batch(rows, true);
+ b.iter(|| {
+ std::thread::scope(|s| {
+ for _ in 0..threads {
+ s.spawn(|| {
+ let options = IpcWriteOptions::default()
+
.try_with_compression(Some(CompressionType::LZ4_FRAME))
+ .unwrap();
+ let mut encoder =
StreamEncoder::try_new_with_options(
+ batch.schema().as_ref(),
+ options,
+ )
+ .unwrap();
+ for _ in 0..10 {
+ black_box(encoder.encode(&batch).unwrap());
Review Comment:
Single thread just measures raw compression speed. The threads=16 cases are
there to catch contention that only shows up when multiple encoders run at
once, e.g. allocator pressure from each one setting up its own buffers. Without
concurrent cases, that kind of regression (or improvement) would be invisible
in these benchmarks.
My guess that different threads will start competing for big allocations
through a single global allocator doing syscalls, but it's just a guess, the
main reason for me to include the multithreaded cases is because I have
empirically tested that the biggest performance improvements happen there.
--
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]