Creating Objects

JavaScript performance comparison

Revision 44 of this test case created by Quentin Brooks

Preparation code

  Vector = function(x, y, w, h) {
    this.x = x;
    this.y = y;

    this.w = w;
    this.h = h;
  Vector.prototype.getFoo = function(){ return; };

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Object.create() using in-place property object
o = new Vector(5, 2, 8, 2);
Object.create() using pre-defined property object
o = {x: 5, y:2, w:8, h:2}

Compare results of other browsers


You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:


Add a comment