Setting Object Properties 2

JavaScript performance comparison

Test case created by Matt Bell

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Set in object literal
var o = {
  x: 10,
  y: 100,
  z: 1000
Set as identifier after object creation
var o = {};
o.x = 10;
o.y = 100;
o.z = 1000;
Set as string property after object creation
var o = {};
o['x'] = 10;
o['y'] = 100;
o['z'] = 1000;

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

Compare results of other browsers


Comment form temporarily disabled.

Add a comment