-
Notifications
You must be signed in to change notification settings - Fork 697
Minor code fixes #2252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor code fixes #2252
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request optimizes memory allocation by reusing the ScoreBreakdown map across document matches instead of creating a new one each time. When a DocumentMatch is reset for reuse, the existing map is now preserved, cleared, and reassigned.
Key changes:
- Modified
DocumentMatch.Reset()to save, clear, and reuse theScoreBreakdownmap - Updated
DisjunctionQueryScorer.ScoreAndExplBreakdown()to check if the map exists before initializing a new one
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| search/search.go | Added logic to preserve and clear the ScoreBreakdown map during DocumentMatch reset for reuse |
| search/scorer/scorer_disjunction.go | Refactored to reuse the existing ScoreBreakdown map if present instead of always creating a new one |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
ScoreBreakdownmap was always getting created, and not being reused. When recycling theDocumentMatch, clear out the score breakdown map and reuse it when needed.