Optimize TopGroups.merge() maxScore computation for relevance sorting#15879
Open
gaobinlong wants to merge 2 commits intoapache:mainfrom
Open
Optimize TopGroups.merge() maxScore computation for relevance sorting#15879gaobinlong wants to merge 2 commits intoapache:mainfrom
gaobinlong wants to merge 2 commits intoapache:mainfrom
Conversation
Signed-off-by: Binlong Gao <gbinlong@amazon.com>
Member
|
Do we have any benchmarks to show the improvement? It seems intuitive to me that there should be nice improvements. |
Contributor
Author
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>
Contributor
Author
|
Hi @benwtrent, could you help to review this PR too? It's as simple as #15942. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.