Creating Objects

JavaScript performance comparison

Revision 43 of this test case created by Quentin Brooks

Preparation code

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

    this.w = w;
    this.h = h;
  };
  Vector .prototype.getFoo = function(){ return this.foo; };
</script>

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 Obj(5, 2, 8, 2);
pending…
Object.create() using pre-defined property object
o = {x: 5, y:2, w:8, h:2}
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. Here’s a list of current revisions for this page:

0 comments

Add a comment