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

perf(filter): reduce allocations in parsing metric #1045

Merged
merged 4 commits into from
Jul 3, 2024

Conversation

almostinf
Copy link
Member

@almostinf almostinf commented Jun 28, 2024

Reduce allocations in parsing metric

Reduced the number of allocations of the restoreMetricStringByNameAndLabels function by setting the capacity in strings.Builder, now the function makes stable 2 allocations to strings.Builder and to slice creation

benchmark                                          old ns/op     new ns/op     delta
BenchmarkRestoreMetricStringByNameAndLabels-12     1071          851           -20.57%

benchmark                                          old allocs     new allocs     delta
BenchmarkRestoreMetricStringByNameAndLabels-12     6              2              -66.67%

benchmark                                          old bytes     new bytes     delta
BenchmarkRestoreMetricStringByNameAndLabels-12     624           320           -48.72%

@almostinf almostinf requested a review from a team as a code owner June 28, 2024 08:31
@almostinf
Copy link
Member Author

/build

@almostinf almostinf merged commit 973caa5 into master Jul 3, 2024
7 checks passed
@almostinf almostinf deleted the perf/metrics-parser branch July 3, 2024 07:40
Copy link

github-actions bot commented Jul 3, 2024

Build and push Docker images with tag: 2024-07-03.973caa5

1 similar comment
Copy link

github-actions bot commented Jul 3, 2024

Build and push Docker images with tag: 2024-07-03.973caa5

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.

3 participants