-
Notifications
You must be signed in to change notification settings - Fork 850
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 DefaultSynchronousMetricStorage iteration #5183
Conversation
Codecov ReportBase: 91.08% // Head: 91.09% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #5183 +/- ##
=========================================
Coverage 91.08% 91.09%
- Complexity 4874 4876 +2
=========================================
Files 549 549
Lines 14418 14420 +2
Branches 1372 1371 -1
=========================================
+ Hits 13133 13136 +3
+ Misses 891 890 -1
Partials 394 394
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
…y-java into optimized-iteration
@@ -131,12 +131,14 @@ public MetricData collect( | |||
|
|||
// Grab aggregated points. | |||
List<T> points = new ArrayList<>(aggregatorHandles.size()); | |||
for (Map.Entry<Attributes, AggregatorHandle<T, U>> entry : aggregatorHandles.entrySet()) { | |||
T point = entry.getValue().aggregateThenMaybeReset(start, epochNanos, entry.getKey(), reset); | |||
for (Attributes attributes : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Randomly saw this PR somehow.
Just curious if .forEach
would work here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice suggestion. This reads better and yields the same reduction in allocations.
Reduces memory allocation required to create
Map.Entry
instances, as discussed in this comment.Performance before:
Performance after: