attribute: use typed slice access in hashKV for slice types#8201
Closed
alliasgher wants to merge 2 commits intoopen-telemetry:mainfrom
Closed
attribute: use typed slice access in hashKV for slice types#8201alliasgher wants to merge 2 commits intoopen-telemetry:mainfrom
alliasgher wants to merge 2 commits intoopen-telemetry:mainfrom
Conversation
Replace reflect.ValueOf + reflection-based iteration with direct typed slice access (asBoolSlice, asInt64Slice, asFloat64Slice, asStringSlice) for BOOLSLICE, INT64SLICE, FLOAT64SLICE, and STRINGSLICE in hashKV. This avoids the per-element reflection overhead — the same improvement applied to the SLICE type in open-telemetry#8166. Fixes open-telemetry#8200 Signed-off-by: alliasgher <alliasgher123@gmail.com>
Contributor
|
Can you post the benchmark difference? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8201 +/- ##
=======================================
- Coverage 82.3% 82.3% -0.1%
=======================================
Files 310 310
Lines 24263 24259 -4
=======================================
- Hits 19983 19979 -4
Misses 3903 3903
Partials 377 377
🚀 New features to boost your workflow:
|
MrAlias
requested changes
Apr 14, 2026
Contributor
MrAlias
left a comment
There was a problem hiding this comment.
This almost certainly degrades the performance as these are now allocating for each call.
Please provide benchmarks to motivate this change.
Contributor
Author
|
Closing , you're right that asBoolSlice() etc. allocate new slices which would degrade performance rather than improve it. I misread the issue. Thanks for the review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8200. Replace
reflect.ValueOf+ reflection iteration with direct typed slice access (asBoolSlice, etc.) for the four slice types inhashKV, matching the same improvement applied to the new SLICE type in #8166.