Closed LockedThread closed 11 months ago
Thanks for opening this, I hadn't heard of ormsgpack
before. I've added it to our benchmarks, see the msgpack benchmarks here.
A brief summary:
msgspec
is roughly 1.3x faster at encoding and 1.5x faster at decoding than ormsgpack
msgspec
is roughly 1.4x faster at encoding and 2.1x faster at decoding than ormsgpack
This may seem counterintuitive - how can msgspec
be faster at decoding AND validating than decoding alone? This is due to two reasons:
msgspec.Struct
types are much more efficient datastructures than dicts, so decoding into a struct type is a cheaper operationAnyway, the gist is that
msgspec
is definitely faster than ormsgpack
in all casesmsgspec
will certainly be faster than ormsgpack
+ pydantic
for decoding and validating msgpack messages.I originally wrote msgspec
specifically as an efficient pydantic-like thing with a high-performance msgpack decoder, so your use case sounds like the ideal case for this library. If you decide to try it out, please let me know if you run into any rough edges.
Question
Are there benchmarks against ormsgpack? I currently use ormsgpack for work in combination with pydantic but the speed degredation of pydantic for validating our extremely large objects is becoming a bottleneck. I am looking for alternatives?