Optimize TopGroups.merge() maxScore computation for relevance sorting#15879
Optimize TopGroups.merge() maxScore computation for relevance sorting#15879gaobinlong wants to merge 2 commits intoapache:mainfrom
Conversation
Signed-off-by: Binlong Gao <gbinlong@amazon.com>
|
Do we have any benchmarks to show the improvement? It seems intuitive to me that there should be nice improvements. |
Thanks @benwtrent , the current code in the benchmark tool luceneutil doesn't cover the TopGroups.merge() method, I cherry-picked the code in the opening PR which introduces TopGroupsCollectorManager and then did benchmark test for this optimization, here're the result: |
Signed-off-by: Binlong Gao <gbinlong@amazon.com>
|
Hi @benwtrent, could you help to review this PR too? It's as simple as #15942. |
|
This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the dev@lucene.apache.org list. Thank you for your contribution! |
Description
When docSort is Sort.RELEVANCE, derive each group's maxScore directly from mergedTopDocs.scoreDocs[0] instead of accumulating across shards via nonNANmax.
Also hoist docSort.equals(Sort.RELEVANCE) into a local boolean to avoid repeated equals() calls in the per-group and per-shard loops.