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

Revision 94 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
Literal notation
person1 = {
    name: "John",
    surname: "Doe",
    age: 30
}
 
ready
array literal
person2 = ["John", "Doe", 30];
ready

Revisions

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