docs: msgpack-lite is much more efficient for large strings
Opened this issue · 1 comments
D1plo1d commented
Just to note, MsgPack-lite is much better then JSON at large strings. If you add a 1.9MB string to the benchmark data you can really start to see an advantage in msgpack-lite's favor. Here's the results I got before the benchmark crashed:
$ ./lib/benchmark.js
operation | op | ms | op/s
--------------------------------------------------------- | -----: | ----: | -----:
buf = Buffer(JSON.stringify(obj)); | 100 | 8776 | 11
obj = JSON.parse(buf); | 100 | 6773 | 14
buf = require("msgpack-lite").encode(obj); | 18000 | 5004 | 3597
obj = require("msgpack-lite").decode(buf); | 19400 | 5026 | 3859
/home/d1plo1d/git_repos/msgpack-lite/node_modules/msgpack.codec/msgpack.codec.js:204
Array.prototype.push.apply(rv, mix);
^
RangeError: Maximum call stack size exceeded
PS. I know 1.9MB is huge, it's a really out there edge case. I am using msgpack-lite to serializing file uploads over WebRTC data channels so for me this is a real world use case and MsgPack totally rocks it!
D1plo1d commented
My results were based on a quick hack at the top of the benchmark:
var data = require("../test/example");
var fs = require("fs");
var longString = fs.readFileSync("/some_directory/benchy.gcode");
data.longString = longString