__proto__ versus Object.create

JavaScript performance comparison

Revision 3 of this test case created by and last updated

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  var proto1 = {method: function () { this.i++; }};
  var badSubclass = {__proto__: proto1, i: 0};
  
  var proto2 = {method: function () { this.i++; }};
  var goodSubclass = Object.create(proto2);
  goodSubclass.i = 0;
  
  
  

};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Object.create
goodSubclass.method();
pending…
__proto__
badSubclass.method();
pending…

Compare results of other browsers

Revisions

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

0 Comments