qiskit-ibmq-provider icon indicating copy to clipboard operation
qiskit-ibmq-provider copied to clipboard

Use orjson for qobj submission

Open mtreinish opened this issue 2 years ago • 1 comments

Summary

This commit changes the default JSON serialization library we use for QOBJ submission to orjson. [1] orjson being written in Rust is significantly faster than the json module in the standard library. In practice it eliminates the serialization overhead of generating the JSON payload from a QOBJ dictionary. However, because orjson is written in rust and doesn't package precompiled wheels for all the platforms we support in tiers 1 and 2 [2] we can't add a hard requirement as it would require users on 32bit platforms to have a Rust compiler to install the provider package. This commit adds it to the requirements list with environment markers to limit it to supported hardware platforms and in the code orjson is treated as an optional dependency. This way by default users on supported platforms get the performance benefits of using orjson.

Details and comments

[1] https://github.com/ijl/orjson [2] https://qiskit.org/documentation/getting_started.html#platform-support

mtreinish avatar Apr 13 '22 15:04 mtreinish

This is still kind of a PoC and I don't necessarily expect this to merge like this. I pushed it more to show how to use orjson for serialization. We similarly could use it for deserialization and get similar speedups on the response side.

mtreinish avatar Apr 13 '22 15:04 mtreinish

closing for now, as this repo will be deprecated - we are looking to maybe use orjson on the server side

kt474 avatar Jan 26 '23 18:01 kt474