-
Notifications
You must be signed in to change notification settings - Fork 772
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
Metric AggregatorStore optimizations for sorting tags #2805
Metric AggregatorStore optimizations for sorting tags #2805
Conversation
Updating the benchmarks numbers with the latest changes of the PR:BenchmarksThere is up to ~63% improvement in Perf for higher number of Tags (updated)// * Summary * BenchmarkDotNet=v0.13.1, OS=Windows 10.0.22000 main
With the new changes
|
Codecov Report
@@ Coverage Diff @@
## main #2805 +/- ##
==========================================
+ Coverage 83.73% 83.82% +0.08%
==========================================
Files 251 250 -1
Lines 8866 8877 +11
==========================================
+ Hits 7424 7441 +17
+ Misses 1442 1436 -6
|
…atorStore-Optimization-New
…atorStore-Optimization-New
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
Co-authored-by: Cijo Thomas <cithomas@microsoft.com>
Looking at the
If it's important to keep these bodies consistent, consider refactoring this out to a helper method. |
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 work @utpilla! This looks like a solid improvement.
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.
LGTM.
Co-authored-by: Reiley Yang <reyang@microsoft.com>
I have created the issue #2843 to track this. |
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.
Great job in improving the perf significantly! LGTM.
Please address the non blocking comments as follow ups.
…ps://github.com/utpilla/opentelemetry-dotnet into utpilla/Metric-AggregatorStore-Optimization-New
return false; | ||
} | ||
|
||
for (int i = 0; i < valuesLength; i++) |
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.
@utpilla Sorry, just noticed this. If we re-order this a bit so we validate that key & value lengths are equal first, then we could use one loop to check the keys & values for equality. Faster that way I think.
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.
I did try this it didn't affect the benchmark numbers that much. I would still update it nonetheless.
Fixes item 1 of #2374
Changes
Tags
(astruct
which has bothstring[]
tagKeys andobject[]
tagValues) and value as anint
which denotes theMetricPoint
index assignedHere is the new look-up algorithm:
metricPointIndex
metricPointIndex
metricPointIndex
metricPointIndex
metricPointIndex
metricPointIndex
metricPointIndex
This means that for any given set of tags, we store the sorted order of the tags and at the most one additional combination of the tags in the dictionary.
Performance Improvement:
Follow-up issues to track: