new vs Object.create (v14)

Revision 14 of this benchmark created by Sander on


Preparation HTML

<script>
  var Klass = function() {};
  
  Klass.prototype.a = function() {};
  Klass.prototype.b = function() {};
  Klass.prototype.c = function() {};
  
  if (typeof Object.create !== "function") {
        Object.create = function(o) {
                function F() {}
                F.prototype = o;
                return new F();
        };
  }

  var count = 10240;
  var result = null;
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
new
  result = new Klass();
ready
Object.create
  result = Object.create(Klass.prototype);
 
ready

Revisions

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