mikemccand commented on code in PR #13692: URL: https://github.com/apache/lucene/pull/13692#discussion_r1732819218
########## lucene/core/src/java/org/apache/lucene/codecs/lucene912/Lucene912PostingsReader.java: ########## @@ -509,15 +547,14 @@ private void refillRemainder() throws IOException { if (docFreq == 1) { docBuffer[0] = singletonDocID; freqBuffer[0] = totalTermFreq; - docBuffer[1] = NO_MORE_DOCS; docCountUpto++; } else { // Read vInts: PostingsUtil.readVIntBlock(docIn, docBuffer, freqBuffer, left, indexHasFreq, needsFreq); prefixSum(docBuffer, left, prevDocID); - docBuffer[left] = NO_MORE_DOCS; docCountUpto += left; } + Arrays.fill(docBuffer, left, docBuffer.length, NO_MORE_DOCS); Review Comment: Hmm this was needed because `findNextGEQ` might test beyond the actual end of the postings in `long[] values`? Since this is more costly than before maybe it is impacting performance and muddying any benefits from `cmov`? Though, this (`refillRemainder`) only happens on the final partially filled block in postings, so it's likely minor impact? ########## lucene/core/src/java/org/apache/lucene/codecs/lucene912/Lucene912PostingsReader.java: ########## @@ -1730,13 +1767,13 @@ private void refillDocs() throws IOException { } else if (docFreq == 1) { docBuffer[0] = singletonDocID; freqBuffer[0] = totalTermFreq; - docBuffer[1] = NO_MORE_DOCS; + Arrays.fill(docBuffer, left, docBuffer.length, NO_MORE_DOCS); docCountUpto++; } else { // Read vInts: PostingsUtil.readVIntBlock(docIn, docBuffer, freqBuffer, left, indexHasFreq, true); prefixSum(docBuffer, left, prevDocID); - docBuffer[left] = NO_MORE_DOCS; + Arrays.fill(docBuffer, left, docBuffer.length, NO_MORE_DOCS); Review Comment: Hmm this instance is potentially more costly? Ahh, but it is also in the "end of postings last partial block" case? -- 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