Here we compare relative speed for encoding and decoding various types of data in various libraries. For details about the data tested and the methods of benchmarking, please see this repository.
- All tests run on:
- MacBook Pro (15-inch, 2017)
- macOS High Sierra (10.13.6)
- 2.9 GHz Intel Core i7
- 16 GB 2133 MHz LPDDR3
- Relative results can vary wildly, for various reasons, in different environments and for different types of data.
- Some libraries tested did not include a decode/parse option, but only sought to create JSON-compatible text in a different or more stable way.
- One library (xson) errored out when decoding some data.
- The native JSON implementation seems to be consistently very fast, though typically the most limited.
- json-complete, while typically towards the bottom of ops/second among these libraries, is never the slowest library except in one case (Node, encoding single value data).
- This isn't unexpected, as it probably has the most features and has not been optimized for performance.
Links to all tested libraries below.
Node (11.4.0) - Data
Google Chrome (76) - Data
Firefox (68) - Data
- JSON (native) - Built-in
- @msgpack/msgpack
- altjson
- bson
- fast-json-stable-stringify
- fast-safe-stringify
- flatted
- gson
- ison
- json-complete
- json-cycle
- json-helpers
- json-literal
- json-stable-stringify
- json-stringify-date
- json-stringify-safe
- json3
- json5
- json7
- jsonify
- kson
- pson
- qjson
- resurrect-js
- rrjson
- rson
- serialize-javascript
- serialize-to-js
- snapshot
- telejson
- xson
- zson