benwtrent commented on code in PR #16034:
URL: https://github.com/apache/lucene/pull/16034#discussion_r3189448520
##########
lucene/core/src/java/org/apache/lucene/util/hnsw/HnswGraphSearcher.java:
##########
@@ -347,6 +348,20 @@ void searchLevel(
if (score >= minAcceptedSimilarity) {
candidates.add(node, score);
if (acceptOrds == null || acceptOrds.get(node)) {
+ // Fetch siblings BEFORE collect() so the parent is not yet in
the heap
+ int[] siblings = null;
Review Comment:
Let's reuse scratch space (it won't add much, but we definitely shouldn't be
creating a new `int[]` on every sibling expansion.)
I would adjust `siblings = expander.pendingSiblingOrdinals(node, visited,
siblings);` to allow reusing scratch space or expanding it and then reusing it
later.
--
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]