-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Preallocate a map of the right size in pcommon Map.AsRaw() #12406
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
Preallocate a map of the right size in pcommon Map.AsRaw() #12406
Conversation
This PR is ok, but I am curious why do you need to call this function and in which component? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #12406 +/- ##
=======================================
Coverage 92.10% 92.10%
=======================================
Files 465 465
Lines 25180 25180
=======================================
Hits 23191 23191
Misses 1592 1592
Partials 397 397 ☔ View full report in Codecov by Sentry. |
Please add a changelog entry |
Done :-) |
@kamstrup ping on
|
Good question :-) We have custom storage engine and we do some massaging of otel payloads to store them most efficiently. We pull the attributes out as a map and rearrange the data. When we have huge nested maps AsRaw starts to show up in the profiles. Not a deal breaker by any means, of course, but just thought it was a nice small improvement |
Description
We are seeing pcommon/Map.AsRaw() show up in the memory profiles.
This PR ensure we pre-allocate a map[string]any of the expected size, instead of just an empty map.