perf(arrow-ipc): Avoid copies and write dictionary batches directly to writers when possible - #10128
perf(arrow-ipc): Avoid copies and write dictionary batches directly to writers when possible#10128JakeDern wants to merge 7 commits into
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 |
|
🤖 Arrow criterion benchmark running (GKE) | trigger CPU Details (lscpu)Comparing ipc-writer-collect-dicts (fd9d7c2) to fed7862 (merge-base) diff File an issue against this benchmark runner |
|
🤖 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 |
|
🤖 Arrow criterion benchmark running (GKE) | trigger CPU Details (lscpu)Comparing ipc-writer-collect-dicts (2bda004) to 98998a8 (merge-base) diff File an issue against this benchmark runner |
|
🤖 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! |
I'm a bit stumped actually, I can't reproduce the perf regression on my machine. Maybe it only happens on ARM64? Will play around with it a bit more... |
|
It's also only occurring after the most recent rebase which is interesting |
8c91263 to
5162fd3
Compare
|
run benchmark ipc_writer |
|
🤖 Arrow criterion benchmark running (GKE) | trigger CPU Details (lscpu)Comparing ipc-writer-collect-dicts (5162fd3) to 505afcb (merge-base) diff Run configurationrun benchmark ipc_writerBENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench ipc_writer File an issue against this benchmark runner |
|
🤖 Arrow criterion benchmark completed (GKE) | trigger Instance: Comparing ipc-writer-collect-dicts (5162fd3) to 505afcb (merge-base) diff Run configurationrun benchmark ipc_writerCPU Details (lscpu)Details
Resource Usagebase (merge-base)
branch
File an issue against this benchmark runner |
|
run benchmark ipc_writer |
1 similar comment
|
run benchmark ipc_writer |
|
seems to have gone down |
|
🤖 Arrow criterion benchmark running (GKE) | trigger CPU Details (lscpu)Comparing ipc-writer-collect-dicts (5162fd3) to 505afcb (merge-base) diff Run configurationrun benchmark ipc_writerBENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench ipc_writer File an issue against this benchmark runner |
|
🤖 Arrow criterion benchmark running (GKE) | trigger CPU Details (lscpu)Comparing ipc-writer-collect-dicts (5162fd3) to 505afcb (merge-base) diff Run configurationrun benchmark ipc_writerBENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench ipc_writer File an issue against this benchmark runner |
|
🤖 Arrow criterion benchmark completed (GKE) | trigger Instance: Comparing ipc-writer-collect-dicts (5162fd3) to 505afcb (merge-base) diff Run configurationrun benchmark ipc_writerCPU Details (lscpu)Details
Resource Usagebase (merge-base)
branch
File an issue against this benchmark runner |
|
🤖 Arrow criterion benchmark completed (GKE) | trigger Instance: Comparing ipc-writer-collect-dicts (5162fd3) to 505afcb (merge-base) diff Run configurationrun benchmark ipc_writerCPU Details (lscpu)Details
Resource Usagebase (merge-base)
branch
File an issue against this benchmark runner |
|
the regression is still there. I'll take a look at the PR to try and help pinpoint it |
Thanks, I was also planning to try and spin up an arm64 machine on gcp this week and see if I could reproduce it there. Will report back on what I find |
|
run benchmark ipc_writer |
|
🤖 Arrow criterion benchmark running (GKE) | trigger CPU Details (lscpu)Comparing ipc-writer-collect-dicts (5162fd3) to 505afcb (merge-base) diff Run configurationrun benchmark ipc_writerBENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench ipc_writer File an issue against this benchmark runner |
|
🤖 Arrow criterion benchmark completed (GKE) | trigger Instance: Comparing ipc-writer-collect-dicts (5162fd3) to 505afcb (merge-base) diff Run configurationrun benchmark ipc_writerCPU Details (lscpu)Details
Resource Usagebase (merge-base)
branch
File an issue against this benchmark runner |
There was a problem hiding this comment.
PR still mostly looks good to me, left a couple suggestions. it may also be useful to look at the profiles of both benchmarks between main and your branch to see if there any new hot spots.
feel free to ping me to run the benchmarks after you update the PR 🚀
|
run benchmark ipc_writer |
|
🤖 Arrow criterion benchmark running (GKE) | trigger CPU Details (lscpu)Comparing ipc-writer-collect-dicts (1091642) to cd7c6b8 (merge-base) diff Run configurationrun benchmark ipc_writerBENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental,object_store --bench ipc_writer File an issue against this benchmark runner |
|
🤖 Arrow criterion benchmark completed (GKE) | trigger Instance: Comparing ipc-writer-collect-dicts (1091642) to cd7c6b8 (merge-base) diff Run configurationrun benchmark ipc_writerCPU Details (lscpu)Details
Resource Usagebase (merge-base)
branch
File an issue against this benchmark runner |
slightly better? |

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.