JSON serialize for naked objects

JavaScript performance comparison

Test case created by Gleb Bahmutov

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  var foo = {
    one: 'one',
    two: 'two',
    three: 3
  };
  var foos = [];
  for(var k = 0; k < 100; k += 1) { foos.push(foo); }
  
  var bar = Object.create(null);
  bar.one = 'one';
  bar.two = 'two';
  bar.three = 3;
  var bars = [];
  for(var k = 0; k < 100; k += 1) { bars.push(bar); }

};
</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
Serializing naked object
JSON.stringify(bars)
pending…
serializing regular object
JSON.stringify(foos)
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