Skip to content

[Java] Optimize BaseValueVector#computeCombinedBufferSize logic #22135

@asfimport

Description

@asfimport

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

 

Reporter: Ji Liu / @tianchen92
Assignee: Ji Liu / @tianchen92

PRs and other links:

Note: This issue was originally created as ARROW-5705. Please see the migration documentation for further details.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions