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

[Java] Remove floating point computation from getOffsetBufferValueCapacity

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • None
    • 0.14.0
    • 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

        Issue Links

          Activity

            People

              fan_li_ya Liya Fan
              fan_li_ya Liya Fan
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              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