Ji Liu created ARROW-5705:
-----------------------------

             Summary: [Java] Optimize BaseValueVector#computeCombinedBufferSize 
logic
                 Key: ARROW-5705
                 URL: https://issues.apache.org/jira/browse/ARROW-5705
             Project: Apache Arrow
          Issue Type: Improvement
          Components: Java
            Reporter: Ji Liu
            Assignee: Ji Liu


Now in BaseValueVector#computeCombinedBufferSize, it computes validity buffer 
size as follow:

_roundUp8(getValidityBufferSizeFromCount(valueCount))_

which can be be expanded to 

_(((valueCount + 7) >> 3 + 7) / 8) * 8_

Seems there's no need to compute bufferSize first and expression above could be 
replaced with:

_(valueCount + 63) / 64 * 8_

In this way, performance of _computeCombinedBufferSize_ would be improved. 
Performance test:

Before:
BaseValueVectorBenchmarks.testC_omputeCombinedBufferSize_ avgt 5 4083.180 ± 
180.363 ns/op

After:

BaseValueVectorBenchmarks.testC_omputeCombinedBufferSize_ avgt 5 3808.635 ± 
162.347 ns/op

 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to