[
https://issues.apache.org/jira/browse/ARROW-5639?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Liya Fan updated ARROW-5639:
----------------------------
Description:
Some getOffsetBufferValueCapacity methods 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
was:
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
> [Java] Remove floating point computation from 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
> Priority: Trivial
> Labels: pull-request-available
> Attachments: image-2019-06-18-20-30-17-826.png
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> Some getOffsetBufferValueCapacity methods 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)