Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
msgpack-lite vs json vs pako gzip
(version: 0)
Comparing performance of:
MessagePack.decode vs JSON.parse vs pako.inflate
Created:
2 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src="https://rawgithub.com/kawanet/msgpack-lite/master/dist/msgpack.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/pako@1.0.11/dist/pako.min.js"></script>
Script Preparation code:
var data = {"L":[{"i":1,"m":1024,"l":1048576,"s":1,"c":2,"f":3,"O":[{"i":1,"k":1},{"i":2,"k":1,"p":1.25},{"i":3,"k":1,"p":2.5},{"i":4,"k":1,"p":3.75},{"i":5,"k":1,"p":5}]},{"i":2,"m":1025,"l":1048577,"s":1,"c":2,"f":3,"O":[{"i":1,"k":1},{"i":2,"k":1,"p":1.25},{"i":3,"k":1,"p":2.5},{"i":4,"k":1,"p":3.75},{"i":5,"k":1,"p":5}]},{"i":3,"m":1026,"l":1048578,"s":1,"c":2,"f":3,"O":[{"i":1,"k":1},{"i":2,"k":1,"p":1.25},{"i":3,"k":1,"p":2.5},{"i":4,"k":1,"p":3.75},{"i":5,"k":1,"p":5}]},{"i":4,"m":1027,"l":1048579,"s":1,"c":2,"f":3,"O":[{"i":1,"k":1},{"i":2,"k":1,"p":1.25},{"i":3,"k":1,"p":2.5},{"i":4,"k":1,"p":3.75},{"i":5,"k":1,"p":5}]},{"i":5,"m":1028,"l":1048580,"s":1,"c":2,"f":3,"O":[{"i":1,"k":1},{"i":2,"k":1,"p":1.25},{"i":3,"k":1,"p":2.5},{"i":4,"k":1,"p":3.75},{"i":5,"k":1,"p":5}]},{"i":6,"m":1029,"l":1048581,"s":1,"c":2,"f":3,"O":[{"i":1,"k":1},{"i":2,"k":1,"p":1.25},{"i":3,"k":1,"p":2.5},{"i":4,"k":1,"p":3.75},{"i":5,"k":1,"p":5}]},{"i":7,"m":1030,"l":1048582,"s":1,"c":2,"f":3,"O":[{"i":1,"k":1},{"i":2,"k":1,"p":1.25},{"i":3,"k":1,"p":2.5},{"i":4,"k":1,"p":3.75},{"i":5,"k":1,"p":5}]},{"i":8,"m":1031,"l":1048583,"s":1,"c":2,"f":3,"O":[{"i":1,"k":1},{"i":2,"k":1,"p":1.25},{"i":3,"k":1,"p":2.5},{"i":4,"k":1,"p":3.75},{"i":5,"k":1,"p":5}]},{"i":9,"m":1032,"l":1048584,"s":1,"c":2,"f":3,"O":[{"i":1,"k":1},{"i":2,"k":1,"p":1.25},{"i":3,"k":1,"p":2.5},{"i":4,"k":1,"p":3.75},{"i":5,"k":1,"p":5}]},{"i":10,"m":1033,"l":1048585,"s":1,"c":2,"f":3,"O":[{"i":1,"k":1},{"i":2,"k":1,"p":1.25},{"i":3,"k":1,"p":2.5},{"i":4,"k":1,"p":3.75},{"i":5,"k":1,"p":5}]}]}; var strBuf = JSON.stringify(data); var buf = msgpack.encode(data); var compressed = pako.gzip(strBuf);
Tests:
MessagePack.decode
var result = msgpack.decode(buf);
JSON.parse
var result = JSON.parse(strBuf);
pako.inflate
var result = JSON.parse(pako.inflate(compressed, { to: 'string' }));
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
MessagePack.decode
JSON.parse
pako.inflate
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:132.0) Gecko/20100101 Firefox/132.0
Browser/OS:
Firefox 132 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
MessagePack.decode
31486.4 Ops/sec
JSON.parse
147012.0 Ops/sec
pako.inflate
34211.0 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
Measuring the performance of different data serialization formats is essential in software development, and MeasureThat.net provides an excellent platform for benchmarking these libraries. **Benchmark Description** The provided benchmark tests the performance of three data serialization formats: MessagePack, JSON, and gzip. The test case uses a complex dataset with nested objects and arrays to simulate real-world scenarios. **Test Cases** There are three test cases: 1. `MessagePack.decode`: This test case measures the time it takes to decode a compressed message using MessagePack. 2. `JSON.parse`: This test case measures the time it takes to parse a JSON string from a buffer. 3. `pako.inflate`: This test case measures the time it takes to inflate a gzip-compressed buffer using the pako library. **Options Compared** The three test cases compare the following options: * **MessagePack**: A binary data serialization format that is designed for efficient and compact storage of complex data structures. * **JSON**: A human-readable text-based data serialization format that is widely used for exchanging data between web servers, web applications, and mobile apps. * **gzip**: A lossless compression algorithm that reduces the size of data by representing it in a compressed form. **Pros and Cons** Here's a brief overview of each option: * **MessagePack**: + Pros: Fast serialization and deserialization times, compact binary format, supports complex data structures like arrays and objects. + Cons: Not as widely supported as JSON, may require additional setup for compatibility with certain systems. * **JSON**: + Pros: Widely supported by most web browsers and servers, human-readable text format makes it easy to debug and analyze. + Cons: Larger binary size compared to MessagePack, slower serialization and deserialization times for complex data structures. * **gzip**: + Pros: Fast compression ratio, widely supported by most systems, can be used with a variety of programming languages. + Cons: Requires additional CPU resources during compression and decompression, larger binary size due to compression. **Benchmark Results** The latest benchmark results show the following execution times per second: * `JSON.parse`: 23,459.103515625 * `MessagePack.decode`: 11,756.3414306640625 * `pako.inflate`: 801.639404296875 These results indicate that JSON is the fastest serialization format for this test case, followed closely by MessagePack, and then gzip. In conclusion, this benchmark provides valuable insights into the performance characteristics of different data serialization formats, which can help developers choose the most suitable option for their specific use cases.
Related benchmarks:
JSON stringification versus simple map
msgpack vs json 2
compare arrays 22
msgpack vs json - encode
Comments
Confirm delete:
Do you really want to delete benchmark?