new vs Object.create (v15)

Revision 15 of this benchmark created by forester on


Preparation HTML

<script>
  function Girl() {}
  Girl.prototype.age = 15;
  Girl.prototype.run = function () {};
  
  var Boy = {
      age: 15,
      run: function () {}
  };
  
  if (typeof Object.create !== "function") {
        Object.create = function(o) {
                function F() {}
                F.prototype = o;
                return new F();
        };
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
new
var girl = new Girl();
ready
Object.create
var boy = Object.create(Boy);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.