Details
-
Wish
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
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.