-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
base: main
Are you sure you want to change the base?
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 91.55% 92.19% +0.64%
==========================================
Files 467 465 -2
Lines 25652 25285 -367
==========================================
- Hits 23485 23311 -174
+ Misses 1768 1575 -193
Partials 399 399 ☔ 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.