Skip to content
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

Do not cache reflect.ValueOf() in metrics Labels #649

Merged
merged 2 commits into from Apr 21, 2020

Conversation

jmacd
Copy link
Contributor

@jmacd jmacd commented Apr 20, 2020

There is a reflect.Value that is cached in the SDK labels type. This is a very minor optimization, having a ~5% impact on the performance of getting labels from a record in the export path. Removing this improves the code clarity.
This relates to #641

BEFORE:

BenchmarkLabelIterator-8   	60768566	        19.3 ns/op	       0 B/op	       0 allocs/op

AFTER:

BenchmarkLabelIterator-8   	58651670	        20.0 ns/op	       0 B/op	       0 allocs/op

@jmacd jmacd changed the title Do not cache reflect.ValueOf() Do not cache reflect.ValueOf() in metrics Labels Apr 20, 2020
@jmacd jmacd merged commit e554562 into open-telemetry:master Apr 21, 2020
@jmacd jmacd deleted the jmacd/labelapi branch April 21, 2020 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants