Repository navigation
Conversation
|
Since there was no existing task covering this case, I added I added a benchmark task set in luceneutil with wikimediumall, it shows an approximately 3x performance improvement for the query, with no performance impact on related tasks. |
sgup432
left a comment
There was a problem hiding this comment.
I see the core issue is in ReqExclBulkScorer, it always leads with the exclScorer, so when the positive side is very selective, picking the dvScorer for exclusion seems expensive.
I wonder in that selective case, can we fallback to ReqExclScorer? Seems like it leads with the required scorer and checks exclusion per candidate via exclScorer.matches(). When the lead is tiny, it is just O(leadCost) and likely cheaper than building a points scorer, which also costs extra memory for the bitset.
|
@sgup432 That makes a lot of sense. When the required cost is much lower than the exclusion cost, using I’ll add benchmarks with sparse required of 5%, 1%, 0.1%, 0.01%, 0.001% to find the threshold where If required is not very spare, |
|
I add the benchmark(
There is a clear threshold between 0.1% and 0.5% from the benchmark:
I will continue benchmarking 0.2%, 0.3%, and 0.4% to determine the best threshold. |
|
@sgup432 The results are as follows:
Under the current benchmark data distribution, there is a clear performance crossover between 0.3% and 0.4%:
I will use 0.3% as the threshold for choosing between |
|
@kkewwei Thanks for the numbers. |
sgup432
left a comment
There was a problem hiding this comment.
Overall LGTM. Some minor comments.
@sgup432 Very thank you for the detail review. Yes. The The scorer numbers are throughput in operations per second ( |
|
@romseygeek Do you think you can help with this one? |
|
@kkewwei Also would be good to contribute your custom task |
romseygeek
left a comment
There was a problem hiding this comment.
LGTM, thanks @kkewwei - I have one small suggestion before I merge.
Description
BooleanScorerSupplier#bulkScorerused the positive scorer's cost as the lead cost for prohibited clauses. For anIndexOrDocValuesQuery, this could incorrectly select the doc-values implementation as the leader inReqExclBulkScorer, With the doc-values implementation, which can require scanning all docs in the segment.This change uses an unbounded lead cost for prohibited clauses, allowing
IndexOrDocValuesQueryto select its index implementation forReqExclBulkScorer.Resolved #16702