jcrist / msgspec

A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML
https://jcristharif.com/msgspec/
BSD 3-Clause "New" or "Revised" License
2.01k stars 59 forks source link

Porting guide for users coming from `orjson` #642

Open jcrist opened 5 months ago

jcrist commented 5 months ago

msgspec's performance is generally on par with that of orjson. For some schemas we're faster, for some orjson is faster. For common message schemas though things should be about the same.

There are some valid reasons a user might prefer to migrate from orjson to msgspec.json instead:

For most users that aren't passing additional config options to orjson, porting should be as straightforward as swapping calls to orjson.loads to msgspec.json.decode and orjson.dumps to msgspec.json.encode. For other options we generally have a corollary, but the spelling is different. A short porting/comparison guide might be useful here.