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:47:00 UTC
[jira] [Updated] (ARROW-17919) [Java] Potentially inefficient variable-width vector reallocation
[ https://issues.apache.org/jira/browse/ARROW-17919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Antoine Pitrou updated ARROW-17919:
-----------------------------------
Description:
In 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.
was:
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.
> [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
> Priority: Minor
>
> In 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)