Object.create() vs. constructor vs. object literal

JavaScript performance comparison

Revision 84 of this test case created

Preparation code

<script>
  var Obj = function(p) {
   this.p = p;
  }
  Obj.prototype.isType = function(){ return this.p === 'illus' }
</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
Constructor function
o = new Obj(1);
pending…
Object.create() using in-place prototype object
o = {p: 1};
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