benwtrent commented on code in PR #13355:
URL: https://github.com/apache/lucene/pull/13355#discussion_r1596942824
##########
lucene/core/src/java/org/apache/lucene/codecs/hnsw/DefaultFlatVectorScorer.java:
##########
@@ -101,7 +102,9 @@ private ByteScoringSupplier(
@Override
public RandomVectorScorer scorer(int ord) throws IOException {
- return new ByteVectorScorer(vectors2, vectors1.vectorValue(ord),
similarityFunction);
+ byte[] ba = vectors1.vectorValue(ord);
+ return new ByteVectorScorer(
+ vectors2, ArrayUtil.copyOfSubArray(ba, 0, ba.length),
similarityFunction);
Review Comment:
My concern is that now for every scorer, we are now creating a new array.
For example, in the HNSW graph builder, now instead of just creating a
couple of backing arrays per thread, we create and require GC to collect a new
one for every node added. This increases the garbage created by millions of
arrays.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]