iprithv opened a new pull request, #15861:
URL: https://github.com/apache/lucene/pull/15861

   ### Description
   
   Introduced an algorithmic optimisation to `PhraseScorer` in `TOP_SCORES` 
mode by reordering the logic within `TwoPhaseIterator.matches()`.
   
   The change enables early short-circuiting of non-competitive documents, 
reducing unnecessary computation for documents that cannot contribute to top 
scoring results. This improves query time efficiency without affecting 
correctness.
   
   ### Change
   
   In `TOP_SCORES` mode, many documents are evaluated even when they have no 
chance of entering the top results. By short circuiting such cases earlier in 
the matching phase, we reduce wasted work and improve overall performance.
   
   ### Benchmarking Results
   
   Compared between `main` and this branch, both runs used identical JMH 
settings (`-wi 3 -i 10 -f 1`). Added this under `benchmark-jmh/` to capture 
this behavior.
   
   | Benchmark                  | Baseline (main)       | Candidate (this PR) | 
Delta  |
   
|---------------------------|----------------------|--------------------|--------|
   | benchmarkExactTopScores   | 2.767 ± 0.181 ops/ms | 2.907 ± 0.261 ops/ms | 
+5.1% |
   | benchmarkSloppyTopScores  | 0.070 ± 0.002 ops/ms | 0.071 ± 0.004 ops/ms | 
+1.4% |
   
   ### Impact
   
   - Improves performance for top-score phrase queries
   
   ### Testing
   
   - Verified correctness with existing test suite
   - Benchmarked using JMH on synthetic datasets


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