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

Optimize InternalAggregations construction a little #120868

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

original-brownbear
Copy link
Member

We can streamline and optimize this logic a little to see less copying and more compact results.
Especially the pattern of copy to ArrayList and then add one is needlessly inefficient because it's a guaranteed resize of the list with a suboptimal underlying array in 100% of cases.
Also, we really only need one way of appending to a buckets aggs list. Out of the various ways we used the code based on .collect(Collectors.toList()) also only worked by accident as that collector does not guarantee a mutable return.
In any case all the stream wrapping and resizing is definitely slower than what's in this PR I'd say + having the same type for the list in more situations is a neat added bonus in terms of compiler behavior.

We can streamline and optimize this logic a little to
see less copying and more compact results.
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jan 26, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Aggregations Aggregations >non-issue Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants