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] [Commented] (ARROW-17919) [Java] Potentially inefficient variable-width vector reallocation

    [ https://issues.apache.org/jira/browse/ARROW-17919?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17612393#comment-17612393 ] 

Antoine Pitrou commented on ARROW-17919:
----------------------------------------

cc [~ljw1001] [~lidavidm] [~emkornfield]

> [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 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)