Object performance, what is better long items or many items?

JavaScript performance comparison

Test case created by Yannick Albert

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
long objects
var eventsObj = {
  target: {
    timestamp1: window,
    timestamp2: document,
    timestamp3: document
  },
  keyCode: {
    timestamp1: 0,
    timestamp2: 66,
    timestamp3: 67
  },
  mouseX: {
    timestamp1: 1,
    timestamp2: 2,
    timestamp3: 3
  },
  mouseY: {
    timestamp1: 0,
    timestamp2: 1,
    timestamp3: 2
  }
};
pending…
many objects
var eventsObj = {
  timestamp1: {
    target: window,
    keyCode: 0,
    mouseX: 1,
    mouseY: 0
  },
  timestamp2: {
    target: document,
    keyCode: 66,
    mouseX: 2,
    mouseY: 1
  },
  timestamp3: {
    target: document,
    keyCode: 67,
    mouseX: 3,
    mouseY: 2
  }
};
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