Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lucene/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ Improvements

Optimizations
---------------------
* Eliminate redundant cardinality() pass in MaxScoreBulkScorer by pre-allocating the
doc/score buffer to the max window size. (Prithvi S)

* GITHUB#15681, GITHUB#15833: Replace pre-sized array or empty array with lambda expression to call Collection#toArray. (Zhou Hui)

* GITHUB#13782: Replace handwritten loops compare with Arrays.compareUnsigned in TermsEnum and TermsEnumFrame classes. (Zhou Hui)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ final class MaxScoreBulkScorer extends BulkScorer {
private final double[] windowScores = new double[INNER_WINDOW_SIZE];

private final DocAndFloatFeatureBuffer docAndScoreBuffer = new DocAndFloatFeatureBuffer();
private final DocAndScoreAccBuffer docAndScoreAccBuffer = new DocAndScoreAccBuffer();
private final DocAndScoreAccBuffer docAndScoreAccBuffer;

MaxScoreBulkScorer(int maxDoc, List<Scorer> scorers, Scorer filter) throws IOException {
this.maxDoc = maxDoc;
Expand All @@ -68,6 +68,8 @@ final class MaxScoreBulkScorer extends BulkScorer {
this.cost = cost;
essentialQueue = DisiPriorityQueue.ofMaxSize(allScorers.length);
maxScoreSums = new double[allScorers.length];
docAndScoreAccBuffer = new DocAndScoreAccBuffer();
docAndScoreAccBuffer.growNoCopy(INNER_WINDOW_SIZE);
}

// Number of outer windows that have been evaluated
Expand Down Expand Up @@ -263,7 +265,6 @@ private void scoreInnerWindowMultipleEssentialClauses(
top = essentialQueue.updateTop();
} while (top.doc < innerWindowMax);

docAndScoreAccBuffer.growNoCopy(windowMatches.cardinality(0, innerWindowSize));
docAndScoreAccBuffer.size = 0;
windowMatches.forEach(
0,
Expand Down
Loading