Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-5639

[Java] Remove floating point computation from getOffsetBufferValueCapacity

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.14.0
    • Component/s: Java

      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:

      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

        Attachments

          Activity

            People

            • Assignee:
              fan_li_ya Liya Fan
              Reporter:
              fan_li_ya Liya Fan

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1.5h
                1.5h

                  Issue deployment