HUSTERGS commented on code in PR #14970:
URL: https://github.com/apache/lucene/pull/14970#discussion_r2218149053


##########
lucene/core/src/java/org/apache/lucene/search/BlockMaxConjunctionBulkScorer.java:
##########
@@ -170,11 +170,18 @@ private void scoreWindowScoreFirst(
         docAndScoreBuffer.size > 0;
         scorers[0].nextDocsAndScores(max, acceptDocs, docAndScoreBuffer)) {
 
+      if (sumOfOtherClauses[1] != sumOfOtherClauses[0]) {

Review Comment:
   Would it be better if we add a boolean member and set the value when 
`computeMaxScore` and use it here ? Just think out loud



##########
lucene/core/src/java/org/apache/lucene/search/MaxScoreBulkScorer.java:
##########
@@ -381,9 +423,20 @@ private void scoreNonEssentialClauses(
       scorer.doc = scorer.iterator.docID();
     }
 
-    for (int i = 0; i < buffer.size; ++i) {
-      scorable.score = (float) buffer.scores[i];
-      collector.collect(buffer.docs[i]);
+    // The collector already filters hits whose score is less than the min 
competitive score, but
+    // doing it here is a bit more efficient.
+    int[] docs = buffer.docs;
+    docAndScoreBuffer.growNoCopy(buffer.size);
+    float[] scores = docAndScoreBuffer.features;
+    int size = buffer.size;

Review Comment:
   This line can be moved before to the `growNoCopy`?



##########
lucene/core/src/java/org/apache/lucene/search/MaxScoreBulkScorer.java:
##########
@@ -381,9 +423,20 @@ private void scoreNonEssentialClauses(
       scorer.doc = scorer.iterator.docID();
     }
 
-    for (int i = 0; i < buffer.size; ++i) {
-      scorable.score = (float) buffer.scores[i];
-      collector.collect(buffer.docs[i]);
+    // The collector already filters hits whose score is less than the min 
competitive score, but
+    // doing it here is a bit more efficient.
+    int[] docs = buffer.docs;
+    docAndScoreBuffer.growNoCopy(buffer.size);
+    float[] scores = docAndScoreBuffer.features;
+    int size = buffer.size;

Review Comment:
   Also, I'm a little bit curious about the performance impact of the tmp 
variable `docs` and `score`, does it helps to the performance?



-- 
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

Reply via email to