DEV Community

Vadim Dalecky
Vadim Dalecky

Posted on

JSON serialization benchmarks in JavaScript

When you pick a binary JSON serializer from NPM, make sure to check the benchmarks. As it stands, if you need to use CBOR or MessagePack, your best bet is to use json-joy, msgpackr or cbor-x. Maybe, if you really like the features of @msgpack/msgpack, you can use that, but it is not as fast as the other three. Pretty much all other NPM packages are significantly slower than the three mentioned above — if you just pick a random package from NPM, you will most likely get an order of magnitude worse performance than what built-in JSON global provides.

json-joy NPM package ships zero-dependency open source json-pack module, which is the fastest implementations of MessagePack, CBOR, and JSON codecs available for JavaScript. How fast is it?

In this benchmarking blog post we take a look at serialization speeds of various NPM implementations of JSON-like codecs, such as MessagePack, CBOR, JSON, UBJSON, and Amazon Ion.

Top comments (0)