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

Revision 39 of this benchmark created on


Preparation HTML

<script>
  Obj = function() {
   this.p = 1;
  }
  
  propObj = {
   p: {
    value: 1
   }
  };
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Object.create() using in-place property object
o = Object.create(Object.prototype, {
 p: {
  value: 1
 }
});
ready
Object.create() using pre-defined property object
o = Object.create(Object.prototype, propObj);
ready
Constructor function
o = new Obj();
ready
Constructor literal
o = {};
ready

Revisions

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