kkewwei commented on code in PR #16849:
URL: https://github.com/apache/lucene/pull/16849#discussion_r4294542496


##########
lucene/core/src/java/org/apache/lucene/util/BitSetIterator.java:
##########
@@ -96,12 +99,18 @@ public long cost() {
   @Override
   public int docIDRunEnd() {
     assert doc != NO_MORE_DOCS;
-    int next = doc + 1;
-    if (next >= length) {
-      return length;
+    // Called once per window by DenseConjunctionBulkScorer: resume from the 
known run end and
+    // bound the scan, otherwise a long run is rescanned on every call, which 
is quadratic.
+    if (doc < runStart || doc >= runEnd) {

Review Comment:
   I checked the code, and the only case where the doc moves backwards is 
in`DefaultBulkScorerBenchmark` . All other call sites set it to a forward 
position.
   
   Since`setDocId` is a public method with no restriction against moving 
backwards, keeping`runStart` is reasonable.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to