Object JSON stringify

JavaScript performance comparison

Test case created by Gleb Bahmutov

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  var foo = {
    prop1: 'property 1',
    prop2: 200,
    prop3: ['foo', 'bar', 'baz'],
    prop4: true,
    prop5: 'another string',
    prop6: {
      foo: 'foo'
    },
    prop7: '200',
    prop8: null,
    prop9: 'this is a test',
    prop10: 'last property'
  };
  
  function assertionMock(condition, msg) {
    return true;
  }

};
</script>

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
assertion with default JSON.stringify
assertionMock(true, JSON.stringify(foo));
pending…
assertion with JSON.stringify(foo, null, 2)
assertionMock(true, JSON.stringify(foo, null, 2));
pending…
Just pass object
assertionMock(true, foo);
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.

0 Comments