Skip to content

docs: msgpack-lite is much more efficient for large strings #104

@D1plo1d

Description

@D1plo1d

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions