Skip to content

Performance: Presize JsonStringArrayList vector results #816

Description

@schlosna

Describe the enhancement requested

FixedSizeListVector#getObject already performs this optimization; however, ListVector, ListViewVector, LargeListVector, and LargeListViewVector do not yet presize the result JsonStringArrayList requiring dynamic reallocations as elements are converted & added. This can become a scalability bottleneck when using these types.

Example of FixedSizeListVector presizing:

publicList<?> getObject(intindex) {
if (isSet(index) == 0) {
returnnull;
}
finalList<Object> vals = newJsonStringArrayList<>(listSize);
for (inti = 0; i < listSize; i++) {
vals.add(vector.getObject(index * listSize + i));

Example ListVector not presizing:

publicList<?> getObject(intindex) {
if (isSet(index) == 0) {
returnnull;
}
finalList<Object> vals = newJsonStringArrayList<>();
finalintstart = offsetBuffer.getInt(index * OFFSET_WIDTH);
finalintend = offsetBuffer.getInt((index + 1) * OFFSET_WIDTH);
finalValueVectorvv = getDataVector();
for (inti = start; i < end; i++) {
vals.add(vv.getObject(i));

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions