Liya Fan created ARROW-5639:
-------------------------------

             Summary: Remove floating point computation from 
BaseVariableWidthVector#getOffsetBufferValueCapacity
                 Key: ARROW-5639
                 URL: https://issues.apache.org/jira/browse/ARROW-5639
             Project: Apache Arrow
          Issue Type: Improvement
          Components: Java
            Reporter: Liya Fan
            Assignee: Liya Fan
         Attachments: image-2019-06-18-20-30-17-826.png

Method BaseVariableWidthVector#getOffsetBufferValueCapacity uses floating point 
computation to calculate the capacity, which is not necessary.

(int) ((offsetBuffer.capacity() * 1.0) / OFFSET_WIDTH);

It is interesting to note that JIT cannot optimize away the floating point 
computations:

 !image-2019-06-18-20-30-17-826.png! 

So this has performance penalty:
Before:
VariableWidthVectorBenchmarks.getValueCapacity  avgt    5  6.570 ± 0.004  ns/op

After:
VariableWidthVectorBenchmarks.getValueCapacity  avgt    5  5.787 ± 0.575  ns/op




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

Reply via email to