Skip to content
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

Faster and shorter SearchPhaseController.reduceQueryPhase #119855

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

original-brownbear
Copy link
Member

We can avoid one list copy and some indirection by collecting to a list of non-null query responses instead of non-null generic responses right away (this also avoids the unfortunate reassignment of a method parameter).
Also, this method is fairly long, this at least removes all redundant local variables and as a result a bit of computation in some cases.

See this as a first step. We could build most of the structures we collect here up-front as we receive the query results
which would make the load pattern a lot less spiky and probably also be faster with how CPU caches work.

We can avoid one list copy and some indirection by collecting to a list of non-null
query responses instead of non-null generic responses right away (this also avoids the unfortunate reassignment of
a method parameter).
Also, this method is fairly long, this at least removes all redundant local variables
and as a result a bit of computation in some cases.
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-foundations (Team:Search Foundations)

@elasticsearchmachine elasticsearchmachine added the Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch label Jan 9, 2025
Copy link
Member

@piergm piergm left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@original-brownbear
Copy link
Member Author

Thanks Matteo!

@original-brownbear original-brownbear added the auto-backport Automatically create backport pull requests when merged label Jan 9, 2025
@original-brownbear original-brownbear merged commit 0ca32f5 into elastic:main Jan 9, 2025
16 checks passed
@original-brownbear original-brownbear deleted the faster-spc branch January 9, 2025 14:35
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.x Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 119855

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged backport pending >non-issue :Search Foundations/Search Catch all for Search Foundations Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants