Object.create() vs. __proto__ (v2)

Revision 2 of this benchmark created on


Preparation HTML

<script>
  var m = {a: 42, b: 7};
  var clone = function (obj) {
    var a = {};
    a.__proto__ = obj;
    return a;
  };
  
  var props = {b: {value: 17}, c: {value: 11}};
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
__proto__
for (var i = 0; i < 1000; i++) {
  var a = clone(m);
  a.b = 17;
  a.c = 11;
  a = null;
}
ready
Object.create()
for (var i = 0; i < 1000; i++) {
  var a = Object.create(m, props);
  a = null;
}
ready

Revisions

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