Comparing ES5 Prototypes and ES6 Classes

JavaScript performance comparison

Test case created by akanshgulati

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
ES6 Class
function testClass(N){
  class Parent{};
  class X extends Parent {}
  for(var i=0; i<N;i++){
    new X();
  }
}
testClass(1e6);
pending…
ES5 Prototypes
function testPrototypes(N){
  function Parent(){}
  function X(){}
  X.prototype = Object.create(Parent.prototype);
  for(var i=0; i<N;i++){
    new X();
  }
}
testPrototypes(1e6);
pending…
ES6 Class with built in Class
function testClass(N){
  class X extends Date{};
  for(var i=0; i<N;i++){
    new X();
  }
}
testClass(1e6);
pending…
ES5 Prototypes with built in Class
function testPrototypes(N){
  function X(){}
  X.prototype = Object.create(Date.prototype);
  for(var i=0; i<N;i++){
    new X();
  }
}
testPrototypes(1e6);
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