Repository navigation
perf(arrow-ipc): Avoid copies and write dictionary batches directly to writers when possible - #10128
Conversation
|
Pretty good improvement - ~42% for the dictionary case and ~20% for delta dictionary cases. Not 100% sure why less improvement on the delta side yet, but I think this is worth it to take on its own and can investigate further later. Perf results from #10122: perf results from this branch: |
|
CC: @alamb and @Rich-T-kid - I think we got pretty good results here! I also tried to clean up a few things here and there where I could like removing some unnecessary parameter drilling. This has the benchmarks from #10122 as well, will rebase once that goes in. |
|
I can take a look at this early next week. |
Rich-T-kid
left a comment
There was a problem hiding this comment.
I think this PR looks mostly fine. it would be nice to include a round trip test similar to ##10097 that validate that nothing is being broken.
left a couple non-blocking comments. Ill try and take a second pass through tommorow if I can get a chance/ if this is still open
2a21b60 to
f9a0328
Compare
|
Took a little longer than I'd have liked, but I got back to rebasing this and fixing it up. @Rich-T-kid or @alamb would definitely appreciate another look.
We do have some round trip tests for the writer, but if there's anything specific missing here, I'm happy to take a stab at adding it! |
|
Ill try and take another look next week |
|
cc @Phoenix500526 in case your interested @JakeDern could you rebase this branch? I think there are outdated changed in your diff |
|
This may also be related #9775 |
|
run benchmark arrow_writer |
This comment was marked as duplicate.
This comment was marked as duplicate.
|
🤖 Arrow criterion benchmark completed (GKE) | trigger Instance: CPU Details (lscpu)Details
Resource Usagebase (merge-base)
branch
File an issue against this benchmark runner |
fd9d7c2 to
2bda004
Compare
I think we're all fixed up now - Nice to see so much IPC activity! |
@alamb I think you meant to run |
|
run benchmark ipc_writer |
This comment was marked as duplicate.
This comment was marked as duplicate.
|
🤖 Arrow criterion benchmark completed (GKE) | trigger Instance: CPU Details (lscpu)Details
Resource Usagebase (merge-base)
branch
File an issue against this benchmark runner |
|
|
Rich-T-kid
left a comment
There was a problem hiding this comment.
The benchmarks look very good and the PR looks nice. I left a couple of suggestions.
I'd like to take a second look as well! could you update the description to explain the flow between calls a bit more? The arrow-ipc reader/writer code takes a lot of context to keep in mind. 😮💨
Rich-T-kid
left a comment
There was a problem hiding this comment.
Thanks @JakeDern this looks good to me. I left a couple comments, mostly nits.
🚀
|
also with @Phoenix500526's #10277 being merged yesterday we may have to rebase this again |
dcfe3f9 to
e946870
Compare
|
Alright @Rich-T-kid, one more rebase for the books! |
|
Am back this week -- will try |
|
@alamb Just a friendly reminder in case you have time to take a look! |
it is not you -- it is me. I see this. I am sorry I haen't had a chance to review. I need to find time to make sure it doesn't cause issues and we have had a large influx of PRs recently it is hard to keep up |
No problem, I totally understand! I don't mean to bother just wanted to keep it on the radar. |
|
run benchmark ipc_writer |
|
🤖 Benchmark starting (GKE) | trigger Target: ipc_writer Sharding factor: 1 (1 workers). Comparing ipc-writer-collect-dicts (7b4210f) to 1e6aef1 (merge-base) diff Run configurationrun benchmark ipc_writer
shards: 1
Results will be posted when all workers finish. File an issue against this benchmark runner |
Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
🤖 Benchmark completed (GKE) | trigger Target: ipc_writer Comparing ipc-writer-collect-dicts (7b4210f) to 1e6aef1 (merge-base) diff Run configurationrun benchmark ipc_writer
shards: 1
DetailsPer-runner informationipc_writer — shard 1/1Node: gk3-benchmark-cluster-nap-orq9b72x-d7b0b158-fnjb Instance: c4a-highmem-16 (12 vCPU / 65 GiB) uname: BENCH_COMMAND: cargo bench --features=arrow,async,test_common,experimental,object_store --bench ipc_writerCPU Details (lscpu)Resource Usagebase (merge-base)
branch
File an issue against this benchmark runner |
alamb
left a comment
There was a problem hiding this comment.
Thank you @JakeDern
And thank you @Rich-T-kid for getting this PR ready to go. I found the code easy to read and well commented and tested
I am really sorry about the delay in review. I just needed to find enough contiguous time to review it
I took the liberty of merging up from main and resolving conflicts / fixing CI due to a new toolchain lint
| self.write_all(&PADDING[..pad_to_alignment(alignment, enc.len())])?; | ||
| } | ||
| self.write_all(&PADDING[..tail_pad])?; | ||
| // Clearing the buffers after the loop instead of draining the vec is |
There was a problem hiding this comment.
I don't understand this -- encoded_buffers is Vec` but each EncodedBuffer is just a few pointers I think. I see #10128 (comment) but am still confused
I wonder if that is some sort of benchmarking effect
There was a problem hiding this comment.
I wish I had a good explanation as to why dropping the Buffers which contain an Arc is less expensive this way, but I don't.
Maybe it's a benchmarking effect of some kind, but if so, it's only reproducible on a Neoverse-V3 chip but not on a Neoverse-V2. My assumption was that there is some performance quirk on that chip, but I can't say I know for sure.
|
CI appears failing due to some sort of docker problem |
Thank you Andrew, I really appreciate you taking the time! I completely empathize with finding enough contiguous time to do a proper review of a change in a critical area of the code and I'm happy to see the quality bar for arrow remain high - We're struggling to keep up over in otel-arrow as well, the PR backlog only gets longer it seems |
Yes, it does for sure 😢 |
…s in IPC writer (#11820) * Backport of #11694 * For inclusion in #11664 * 58 backport is #11817 (requested in #11665 (comment)) Cherry-pick of [49219f8](49219f8) The cherry-pick applied cleanly but did not compile: on main `write_array_data` has a `null_count` local introduced by #10128, which is not on `59_maintenance`. This PR adds that one-line local (`let null_count = array_data.null_count();`) so the backported code matches main. Co-authored-by: Aleksandar Zecevic <[email protected]>

Which issue does this PR close?
Rationale for this change
This is a follow on to #10044, applying basically the same optimization for dictionary batches.
This needs to wait for #10122 before merge.
What changes are included in this PR?
Are these changes tested?
Yes, existing unit tests should cover the change.
Are there any user-facing changes?
No.