You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Technically there would be a side effect in that data could be left over in the buffer, and then make it into IPC, but that is the tradeoff. (I believe it's already possible if say you create a string vector, add data, and later set the row count to something lower than before - the extra data won't be cleared.)
Technically there would be a side effect in that data could be left over in the buffer, and then make it into IPC, but that is the tradeoff. (I believe it's already possible if say you create a string vector, add data, and later set the row count to something lower than before - the extra data won't be cleared.)
Yeah that make sense.
And @ViggoC thanks for looking into this, I am looking into the PR as well. This is much needed to improve the initial version.
@vibhatha And I also see that VariableWidthViewVector allocated much more memory than VariableWidthVector in some cases. It runs out of memory(8G) before I changed the allocator.close to iteration level.
Hmm, I think we still allocate power-of-two buffers for each of the data buffers, probably we should instead round to some multiple of say 64K or 1 MB or something instead. The implementation is still new so we are working out how best to treat it.
@ViggoC technically the answer is yes, I can do it, but in a practical sense my phase would be significantly slower than earlier because the time I could allocate would be significantly smaller. If this needs fixing sooner, the best I can do is help to figure out things to do and definitely review the PR if you could work on this feature.
No, that diagram only applies to short strings. It's not specified what happens to long strings.
yeah, when i mentioned padding, i mean short string, there is no padding data for long string. for long string, every bytes in viewbuffer will be overwritten. so at least we can skip viewbuffer.setZero for long string.
Checking first and then deciding whether to skip setZero, as done in the commit 30e595411e37b7ca2739c7005442ed7b329eeaea, does not work in the benchmark because the vector is always reused.
After change the setup level and call zeroVector in prepare (see 374357d), the check and set works for step 1 and 2. For step 10 and 40 cases, the performance decrease a lot because we run out of the pre allocated memory, setZero is required for the reallocated memory.
@lidavidm Combined with memory pre-allocation, the solution in PR #557 effectively reduces the performance overhead of setZero for both long and short values.
Reacted by David Li, Vibhatha Lakmal Abeykoon and Gang Wu
Activity
[-]VariableWidthViewVectorBenchmarks[/-][+][Java] VariableWidthViewVectorBenchmarks[/+]lidavidm commentedon Nov 5, 2024
Thanks for digging into this @ViggoC! I think we can take out the setZero since unreferenced data is unspecified
ViggoC commentedon Nov 5, 2024
@lidavidm So we can just remove it without side effort?
lidavidm commentedon Nov 5, 2024
What do you mean side effort?
vibhatha commentedon Nov 5, 2024
Is it side effect?
lidavidm commentedon Nov 5, 2024
Oh, good point.
Technically there would be a side effect in that data could be left over in the buffer, and then make it into IPC, but that is the tradeoff. (I believe it's already possible if say you create a string vector, add data, and later set the row count to something lower than before - the extra data won't be cleared.)
vibhatha commentedon Nov 5, 2024
Yeah that make sense.
And @ViggoC thanks for looking into this, I am looking into the PR as well. This is much needed to improve the initial version.
ViggoC commentedon Nov 5, 2024
@lidavidm sorry, my bad, I mean side effect.
@vibhatha so you'll handle this performance issue?
ViggoC commentedon Nov 5, 2024
@vibhatha And I also see that VariableWidthViewVector allocated much more memory than VariableWidthVector in some cases. It runs out of memory(8G) before I changed the
allocator.closeto iteration level.lidavidm commentedon Nov 5, 2024
Hmm, I think we still allocate power-of-two buffers for each of the data buffers, probably we should instead round to some multiple of say 64K or 1 MB or something instead. The implementation is still new so we are working out how best to treat it.
vibhatha commentedon Nov 5, 2024
@ViggoC technically the answer is yes, I can do it, but in a practical sense my phase would be significantly slower than earlier because the time I could allocate would be significantly smaller. If this needs fixing sooner, the best I can do is help to figure out things to do and definitely review the PR if you could work on this feature.
ViggoC commentedon Nov 5, 2024
IMHO, The only side effect of removing
viewBuffer.setZerois that padding data is no longer 0, Right?lidavidm commentedon Nov 5, 2024
ah...are the requirements for variable width vector different? if they must be 0-padded then we can't do anything here.
lidavidm commentedon Nov 5, 2024
No, that diagram only applies to short strings. It's not specified what happens to long strings.
1 remaining item
ViggoC commentedon Nov 5, 2024
"Any remaining bytes after the string itself are padded with 0."
https://arrow.apache.org/docs/format/Columnar.html#:~:text=Any%20remaining%20bytes%20after%20the%20string%20itself%20are%20padded%20with%200.
ViggoC commentedon Nov 5, 2024
yeah, when i mentioned padding, i mean short string, there is no padding data for long string. for long string, every bytes in viewbuffer will be overwritten. so at least we can skip viewbuffer.setZero for long string.
ViggoC commentedon Nov 5, 2024
commit 30e595411e37b7ca2739c7005442ed7b329eeaea. the benchmark only involves long string, so it shows a big improvement.
ViggoC commentedon Jan 23, 2025
Here is the result of VariableWidth(View)VectorInlineValueBenchmarks
before
after comment out setZero
Checking first and then deciding whether to skip setZero, as done in the commit 30e595411e37b7ca2739c7005442ed7b329eeaea, does not work in the benchmark because the vector is always reused.
ViggoC commentedon Jan 23, 2025
After change the setup level and call zeroVector in prepare (see 374357d), the
check and setworks for step 1 and 2. For step 10 and 40 cases, the performance decrease a lot because we run out of the pre allocated memory, setZero is required for the reallocated memory.Flame graph for step 1 / 2

Flame graph for step 10 / 40
ViggoC commentedon Jan 23, 2025
@lidavidm Combined with memory pre-allocation, the solution in PR #557 effectively reduces the performance overhead of setZero for both long and short values.
lidavidm commentedon Jan 24, 2025
Thanks for investigating this!
GH-41: Add VariableWidthViewVectorBenchmarks (#453)
vibhatha commentedon Jan 24, 2025
@ViggoC Thanks a lot. This is awesome work.
apacheGH-41: BaseVariableWidthViewVector setZero only if necessary (a…