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 analysis calculation #495

Merged
merged 3 commits into from
Nov 6, 2024

Conversation

fpetkovski
Copy link
Collaborator

Aggregating analyzed results is slow for complex expressions because we aggregate samples over and over again.

This commit speeds that up by memoizing aggregates.

Aggregating analyzed results is slow for complex expressions
because we aggregate samples over and over again.

This commit speeds that up by memoizing aggregates.

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
Comment on lines 201 to 203
sum := *(*current).(*Aggregation)
sum := *(*current).Clone().(*Aggregation)
sum.Op = parser.SUM
count := *(*current).(*Aggregation)
count := *(*current).Clone().(*Aggregation)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this related?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch, reverted.

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
Copy link
Member

@saswatamcode saswatamcode left a comment

Choose a reason for hiding this comment

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

Thanks!

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
@fpetkovski fpetkovski merged commit 097e6e9 into thanos-io:main Nov 6, 2024
7 checks passed
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.

4 participants