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

[Java] Optimize BaseValueVector#computeCombinedBufferSize logic

    XMLWordPrintableJSON

    Details

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

      Description

      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

       

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                tianchen92 Ji Liu
                Reporter:
                tianchen92 Ji Liu
              • Votes:
                0 Vote for this issue
                Watchers:
                2 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 - 4h 20m
                  4h 20m