Skip to content

Commit 56b525e

Browse files
committed
refactor: avoid redundant array allocation
1 parent 7cfcb6b commit 56b525e

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

src/main/java/io/weaviate/client6/v1/internal/grpc/ByteStringUtil.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,7 @@ public static float[][] decodeVectorMulti(ByteString bs) {
9797
// so we always read from offset=0.
9898
float[][] vectors = new float[n][dimensions];
9999
for (int i = 0; i < n; i++) {
100-
float[] v = new float[dimensions];
101-
// TODO: use pre-allocated array rather than creating a new one
102-
// fbuf.get(vectors[i], 0, dimensions);
103-
fbuf.get(v, 0, dimensions);
104-
vectors[i] = v;
100+
fbuf.get(vectors[i], 0, dimensions);
105101
}
106102
return vectors;
107103
}

0 commit comments

Comments
 (0)