zabuldon / teslajsonpy

Apache License 2.0
57 stars 62 forks source link

perf: avoid bytes to text conversion overhead #411

Closed bdraco closed 1 year ago

bdraco commented 1 year ago

orjson can decode bytes directly without the need to convert it to text first.

Avoid calling .text since it has to do extra processing under the hood in debug as well

alandtse commented 1 year ago

Just to confirm, you've tested this to make sure our API use isn't expecting text responses? I can't remember how we designed this.

bdraco commented 1 year ago

I've been running this in production on two systems and all good.

orjson.loads takes any of bytes bytearray memoryview str https://github.com/ijl/orjson#deserialize so it should handle text or bytes just fine

alandtse commented 1 year ago

Thanks for confirming. Perf won't trigger a release but apparently we have a bug that needs to be squashed so I think we'll have a release soon.