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

[Java] Potentially inefficient variable-width vector reallocation

    XMLWordPrintableJSON

Details

    • Wish
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • Java
    • None

    Description

      In several places in the Java codebase you can see this kind of pattern:

          while (vector.getDataBuffer().capacity() < toCapacity) {
            vector.reallocDataBuffer();
          }
      

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            apitrou Antoine Pitrou
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: