bjson vs msgpackold vs json vs coffeepack vs msgpacknew vs BinaryPack vs msgpack

JavaScript performance comparison

Revision 4 of this test case created by Andrew Bennett

Info

Performance test beetween bjson vs msgpackold vs json vs coffeepack vs msgpacknew vs BinaryPack vs msgpack

Preparation code

<script src="http://jonasfj.github.com/BJSON.coffee/src/encoding.js"></script>
<script src="http://jonasfj.github.com/BJSON.coffee/bin/BJSON.js"></script>
<script src="https://rawgithub.com/msgpack/msgpack-javascript/master/msgpack.js"></script>
<script src="https://rawgithub.com/devongovett/coffeepack/master/msgpack.js"></script>
<script>
window.msgpackold = window.msgpack;
window.msgpack = undefined;
</script>
<script src="https://rawgithub.com/creationix/msgpack-js-browser/master/msgpack.js"></script>
<script>
window.msgpacknew = window.msgpack;
window.msgpack = undefined;
</script>
<script src="https://rawgithub.com/binaryjs/binaryjs/master/dist/binary.js"></script>
<script src="http://software.hixie.ch/utilities/cgi/content-type-proxy/content-type-proxy?uri=https%3A%2F%2Fbitbucket.org%2Fsirpengi%2Fmsgpack-js%2Fraw%2F8f4cc4695def57e5222c7c44169807d4b6847eb7%2Fmsgpack.js&type=application%2Fjavascript"></script>
<script>
Benchmark.prototype.setup = function() {
    var objectTest = {
      'abcdef': 1,
      'qqq': 13,
      '19': [1, 2, 3, 4]
    };
    var blob = BinaryPack.pack(objectTest);
    var arrayBuffer = null;
    var fileReader = new FileReader();
    fileReader.onload = function() { arrayBuffer = fileReader.result; };
    fileReader.readAsArrayBuffer(blob);
};
</script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
BJSON
BJSON.parse(BJSON.serialize(objectTest));
pending…
msgpackold
msgpackold.unpack(msgpackold.pack(objectTest))
pending…
JSON
JSON.parse(JSON.stringify(objectTest));
pending…
MsgPack
MsgPack.unpack(MsgPack.pack(objectTest))
pending…
msgpacknew
msgpacknew.decode(msgpacknew.encode(objectTest))
pending…
BinaryPack
BinaryPack.pack(objectTest);
if (arrayBuffer !== null) BinaryPack.unpack(arrayBuffer);
pending…
msgpack
msgpack.unpack(msgpack.pack(objectTest))
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment