node-msgpack
node-msgpack copied to clipboard
The results in the readme are misleading
I just run the benchmark on node 4.x here and msgpack is way slower than JSON.
↪ ./run_tests test/benchmark/benchmark.js
benchmark.js
msgpack.pack: 7171ms, JSON.stringify: 2373ms
ratio of JSON.stringify/msgpack.pack: 0.33091619021057034
✔ benchmark - JSON.stringify faster than msgpack.pack with array of 1m objects
msgpack.pack: 8614ms, JSON.stringify: 3252ms
ratio of msgpack.pack/JSON.stringify: 2.648831488314883
✔ benchmark - JSON.stringify faster than msgpack.pack over 1m calls
msgpack.unpack: 4959ms, JSON.parse: 1522ms
ratio of JSON.parse/msgpack.unpack: 3.2582128777923787
✔ benchmark - JSON.parse faster than msgpack.unpack over 1m calls
msgpack pack: 6622 ms
msgpack unpack: 9435 ms
json pack: 2983 ms
json unpack: 3738 ms
msgpack pack: 13744 ms
msgpack unpack: 28709 ms
json pack: 3352 ms
json unpack: 3732 ms
msgpack pack: 11742 ms
msgpack unpack: 24797 ms
json pack: 3187 ms
json unpack: 3829 ms
✔ benchmark - output above is from three runs on a 1m element array of objects
msgpack pack: 9234 ms
msgpack unpack: 6004 ms
json pack: 3019 ms
json unpack: 1953 ms
msgpack pack: 9205 ms
msgpack unpack: 5706 ms
json pack: 2491 ms
json unpack: 1536 ms
msgpack pack: 8342 ms
msgpack unpack: 5194 ms
json pack: 2471 ms
json unpack: 1541 ms
✔ benchmark - output above is from three runs of 1m individual calls
OK: 5 assertions (217708ms)
From the readme:
Testing shows that, over 500k iterations, msgpack.pack() is about 5x slower than JSON.stringify(), and msgpack.unpack() is about 3.5x slower than JSON.parse().
That seems consistent with your results, no?
edit: Oh, just noticed the date of the issue. This seems abandoned.