jimczi commented on code in PR #12529: URL: https://github.com/apache/lucene/pull/12529#discussion_r1319990727
########## lucene/backward-codecs/src/java/org/apache/lucene/backward_codecs/lucene90/Lucene90HnswVectorsReader.java: ########## @@ -423,8 +422,12 @@ public RandomAccessVectorValues<float[]> copy() { @Override public float[] vectorValue(int targetOrd) throws IOException { + if (lastOrd == targetOrd) { + return value; + } Review Comment: Not on normal search where only the query vector is used multiple times but it happens frequently when we build the index during the diversification phase. There, we compare single ordinals with all their neighbors sequentially so instead of having the optimisation in the graph I moved it to the reader since it's straightforward to add and shouldn't add any overhead to check. -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org