Skip to content

Lazy initialization of score and list objects in search. #8809

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

Merged
merged 4 commits into from
Jun 10, 2025

Conversation

isoos
Copy link
Collaborator

@isoos isoos commented Jun 6, 2025

  • Part of Package search index improvements (tracking issue) #8671, with multiple small changes, each verified that improves or does not degrades the performance. Overall improvement seems to be 3-8% depending on the query.
  • IndexedScore object is initalized on-demand with the withItemGetter wrapper method. This skips the allocation and more importantly the reset of the score array, and also its population when there is no text search component.
  • Early return of query processing when _TextResults.hasNoMatch is set (skips additional post-processing).
  • Pre-computed lists can be filtered through either BitArray or IndexedScore index iteration, making it possible to skip the IndexedScore initialization.
  • The total hit count calculation is based on the bit array or the indexed score object, there is no need to build a full *Hit list of the result just for counting them.
  • Removed nullability in multiple places.
  • No functional change otherwise.

@isoos isoos requested review from szakarias and sigurdm June 6, 2025 14:53
@isoos
Copy link
Collaborator Author

isoos commented Jun 6, 2025

Note: I've got mixed results with top-k sorting (vs full result list sorting), not sure why, this needs some further exploration.

Also: now that the overall improvement is verified, I'm happy to split up this PR to incremental parts, if needed.

@isoos isoos changed the title Lazy use of score and list objects in search. Lazy initialization of score and list objects in search. Jun 6, 2025
Copy link
Contributor

@sigurdm sigurdm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

isoos and others added 2 commits June 10, 2025 09:34
@isoos isoos merged commit 875a7ba into dart-lang:master Jun 10, 2025
31 checks passed
@isoos isoos deleted the search-lazy branch June 10, 2025 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants