Uh oh!
There was an error while loading. Please reload this page.
ARROW-11989: [C++][Python] Improve ChunkedArray's complexity for the access of elements - #12055
ARROW-11989: [C++][Python] Improve ChunkedArray's complexity for the access of elements#12055edponce wants to merge 25 commits into
Conversation
edponce
commented
Dec 30, 2021
Here are some preliminary measurements showing an improvement for a particular example (1024 chunks each with 1024 values and using an incremental search). The following are still missing in this PR:
|
pitrou
commented
Jan 4, 2022
I think we should simply factor out and reuse the chunk resolver from |
edponce
commented
Jan 4, 2022
@pitrou Thanks! I had no idea of the existence of |
pitrou
commented
Jan 4, 2022
Sorry. I should have mentioned it on the JIRA. |
pitrou
commented
Jan 27, 2022
@edponce Are you willing to push this forward? |
eelxpeng
commented
Feb 25, 2022
edponce
commented
Feb 25, 2022
Hi @eelxpeng, I will work on this today. Apologies for the delay. |
7eec701 to
afd4022Compare45167f3 to
95a3d30Compareeelxpeng
commented
Mar 6, 2022
Verified the speed improvement on the example provided above. Thanks for the good work! @edponce I have one question, does the change revises the arrow file and saves necessary information in the file? Or is it simply does not touch the arrow file structure but just resolve the index with more efficient search? I asked this because I experienced longer access time for existing large multi-chunk arrow file with the change. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
pitrou
commented
Mar 10, 2022
pitrou
commented
Mar 10, 2022
@ursabot please benchmark lang=C++ |
Benchmark runs are scheduled for baseline = 93b192c and contender = 95a3d30e5c78cea6ea40748e268ceb270b3092a8. Results will be available as each benchmark for each run completes. |
95a3d30 to
adaf18bCompareUh oh!
There was an error while loading. Please reload this page.
b137a83 to
a711336Compareedponce
commented
Mar 12, 2022
@ursabot please benchmark lang=C++ |
Benchmark runs are scheduled for baseline = 5592cf7 and contender = a711336db6a3095a4be320adceaf147826c2bdaf. Results will be available as each benchmark for each run completes. |
a711336 to
7ac8aefCompareUh oh!
There was an error while loading. Please reload this page.
7ac8aef to
dda5d95CompareThere are 2 main solutions for the type of
Based on this info, I favor the |
dda5d95 to
5f709ccCompareb68ea2a to
6515bdcCompareedponce
commented
Apr 13, 2022
@pitrou This PR is ready for final reviews. Thanks for all the great reviews. |
beeafb7 to
9f7d8a6Compare9f7d8a6 to
76b25ffComparepitrou
commented
Apr 14, 2022
@ursabot please benchmark lang=C++ |
Benchmark runs are scheduled for baseline = 5d5cceb and contender = 76b25ff. Results will be available as each benchmark for each run completes. |
pitrou
left a comment
There was a problem hiding this comment.
+1, will just wait for benchmark results
ursabot
commented
Apr 15, 2022
Benchmark runs are scheduled for baseline = 7dc8683 and contender = 4e49aa8. 4e49aa8 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
eelxpeng
commented
May 1, 2022
Not sure about why. I have a large arrow file with 115545630 rows and 488 chunks. Even using the fix in this pr, the time to randomly access 1000 rows is 2102 seconds. While if I re-process the arrow file to make it 115545630 rows and 1 chunk, the time is 72 seconds. The difference is huge. |
Hi @eelxpeng, the implementation in this PR caches the previous chunk used, so it is expected to be faster when using 1 chunk because it results in perfect caching. Randomly accessed chunks are searched using a binary search and the chunk caching operations would only add a very small penalty instead. How do your results compare to Arrow before this patch got merged? |
edponce
commented
May 1, 2022
I can set up benchmarks this week to investigate further performance with varying chunk sizes. |
pitrou
commented
May 1, 2022
This sounds really huge and unrelated to this PR. Are you accessing the file over local storage or a remote filesystem? |
@edponce with previous Arrow version (7.0.0) before this patch, the time is 1510 seconds for the 488 chunks file. |
eelxpeng
commented
May 1, 2022
@pitrou How does it not related to this PR? In this case, 1 chunk is significantly faster than 488 chunks. I'm accessing via efs (https://aws.amazon.com/efs/). |
pitrou
commented
May 1, 2022
It's not related because the runtimes are incompatible with the CPU time needed for calculating chunk indices. That said, it's worth opening an issue for this. |
Improves search time for finding a chunk in ChunkedArray using a binary search, O(log n) for random access.
Chunks are searched when invoking
GetScalar()(C++) and index operator (Python).