Simple Object.create() performance test

JavaScript performance comparison

Revision 85 of this test case created by amit

Preparation code

<script>
  function _P() {
   this.p = 1;
  };

  function object(o) {
      function F() {}
      F.prototype = o;
      return new F();
  }
</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
var withoutNew  = Object.create(Object.prototype, {
 p: {
  value: 1
 }
});
pending…
With New
var withNew = new function(){this.p=1;}()
pending…
With New
var with_new = new _P();
pending…
With New:Crockford
o = object({p: 1});
pending…
Without New
var fastest = {"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