You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Antoine Pitrou (Jira)" <ji...@apache.org> on 2022/10/03 17:46:00 UTC
[jira] [Created] (ARROW-17919) [Java] Potentially inefficient variable-width vector reallocation
Antoine Pitrou created ARROW-17919:
--------------------------------------
Summary: [Java] Potentially inefficient variable-width vector reallocation
Key: ARROW-17919
URL: https://issues.apache.org/jira/browse/ARROW-17919
Project: Apache Arrow
Issue Type: Wish
Components: Java
Reporter: Antoine Pitrou
In a several places in the Java codebase you can see this kind of pattern:
{code:java}
while (vector.getDataBuffer().capacity() < toCapacity) {
vector.reallocDataBuffer();
}
{code}
In the event that a much larger capacity is requested, this will spuriously make several reallocations (doubling the capacity each time).
It would probably be more efficient to reallocate directly to satisfy the desired capacity.
Coincidentally, there's a {{reallocDataBuffer}} overload that seems to do just that.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)