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

Revision 31 of this benchmark created on


Preparation HTML

<script>
  var o;

  var Obj = function() {
   this.p = 1;
  };
  
  var propObj = {
   p: {
    value: 1
   }
  };
  
  var protoObj = {p: 1};
  
  function object(o) {
      function F() {}
      F.prototype = o;
      return new F();
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Object constructor
o = new Object();
ready
Object literal
o = {};
ready

Revisions

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