@msgpack/msgpack

JavaScript performance comparison

Test case created by gfx

Preparation code

<script crossorigin src="//unpkg.com/@msgpack/msgpack@1.6.0/dist.es5/msgpack.min.js"></script>
<script>
"use strict";
var dataset;
fetch("https://raw.githubusercontent.com/msgpack/msgpack-javascript/master/benchmark/sample-large.json")
.then((response) => response.json())
.then((json) => { dataset = json })
.catch((error) => { console.error(error) })
</script>
      
<script>
Benchmark.prototype.setup = function() {
  "use strict";
  
  if (!dataset) {
    alert("dataset is not ready.");
    throw new Error("dataset is not ready");
  }
  
  var encoded = MessagePack.encode(dataset);
  var createEncodedStream = async function *() {
    yield encoded;
  };
  var json = JSON.stringify(encoded);
  var decoded;
  

};
</script>

Preparation code output

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
decode
// async test
"use strict";

decoded = MessagePack.decode(encoded);

deferred.resolve();
pending…
decodeAsync
// async test
"use strict";

MessagePack.decodeAsync(createEncodedStream()).then((o) => {
  decoded = o;

  deferred.resolve();
});
pending…
JSON.parse
// async test
"use strict";

decoded = JSON.parse(json);

deferred.resolve();
pending…

You can edit these tests or add even more tests to this page by appending /edit to the URL.

Compare results of other browsers

0 Comments