Adrien Grand created LUCENE-7421:
------------------------------------

             Summary: Speed up BS2 by caching the 2nd lowest doc id in the 
priority queue
                 Key: LUCENE-7421
                 URL: https://issues.apache.org/jira/browse/LUCENE-7421
             Project: Lucene - Core
          Issue Type: Improvement
            Reporter: Adrien Grand
            Assignee: Adrien Grand
            Priority: Minor


BS2 uses a priority queue in order to merge several sorted iterators into a new 
sorted iterator. We call updateTop every time that we move the 'top' iterator 
forward, which requires to check the size of the priority queue at least twice 
and perform at least two comparisons of doc ids.

Instead, DisjunctionSumScorer could cache the 2nd lowest doc id of the priority 
queue and only call updateTop when the doc id of the entry at the top of the 
priority queue goes beyong the 2nd lowest doc id. While this would involve 
slightly more work in the case that the PQ has two high-cardinality clauses 
whose docs are interleaved, this would help when one clause has a much higher 
cardinality than the other ones or when the doc ids of the various clauses are 
clustered.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to