You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In server handling, we currently have two use cases:
marshaling into yaml and then converting yaml to json.
marshaling straight to json using the standard library.
There are json libraries more performant than the json standard library package and provide configuration on the build tag, allowing us to not have to effectively marshal twice for the yaml -> json conversion. I looked into json-iterator, which is imported in other open-telemetry repos and showed good benchmarks. To see if it was the right fit for us, I wrote benchmarks for our server handling functions to see how json-iterator compares to the standard library package:
The prometheus structs have special MarshalYAML() functions that a json marshaler won't find and use. Specifically the Regex struct has no exported fields, so all data is lost there.
In server handling, we currently have two use cases:
There are json libraries more performant than the
json
standard library package and provide configuration on the build tag, allowing us to not have to effectively marshal twice for the yaml -> json conversion. I looked intojson-iterator
, which is imported in other open-telemetry repos and showed good benchmarks. To see if it was the right fit for us, I wrote benchmarks for our server handling functions to see how json-iterator compares to the standard library package:#1323
benchmarks.txt
In terms of both memory and cpu, json-iterator performed better in all of my tests, especially as objects grew larger.
I'm interested in hearing others' thoughts on this - is this a change people are open to making?
The text was updated successfully, but these errors were encountered: