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

JavaScript performance comparison

Revision 84 of this test case created

Preparation code

  var Obj = function(p) {
   this.p = p;
  Obj.prototype.isType = function(){ return this.p === 'illus' }

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);
Object.create() using in-place prototype object
o = {p: 1};

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