Skip to content

Commit

Permalink
Remove unused +1 on doc buffer length. (#14043)
Browse files Browse the repository at this point in the history
We no longer take advantatge of it.
  • Loading branch information
jpountz authored Dec 6, 2024
1 parent ef2e254 commit 8103f2a
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ final class BlockPostingsEnum extends ImpactsEnum {
private ForDeltaUtil forDeltaUtil;
private PForUtil pforUtil;

private final int[] docBuffer = new int[BLOCK_SIZE + 1];
private final int[] docBuffer = new int[BLOCK_SIZE];

private int doc; // doc we last read

Expand Down Expand Up @@ -418,10 +418,6 @@ public BlockPostingsEnum(FieldInfo fieldInfo, int flags, boolean needsImpacts)
this.needsImpacts = needsImpacts;
needsDocsAndFreqsOnly = needsPos == false && needsImpacts == false;

// We set the last element of docBuffer to NO_MORE_DOCS, it helps save conditionals in
// advance()
docBuffer[BLOCK_SIZE] = NO_MORE_DOCS;

if (needsFreq == false) {
Arrays.fill(freqBuffer, 1);
}
Expand Down Expand Up @@ -586,7 +582,6 @@ private void refillFullBlock() throws IOException {
prevDocID = docBuffer[BLOCK_SIZE - 1];
docBufferUpto = 0;
posDocBufferUpto = 0;
assert docBuffer[docBufferSize] == NO_MORE_DOCS;
}

private void refillRemainder() throws IOException {
Expand Down

0 comments on commit 8103f2a

Please sign in to comment.