Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0
Firefox 56
Windows 7
Desktop
6 years ago
Test name Executions per second
bind 12871160.0 Ops/sec
arrow 43611788.0 Ops/sec
Script Preparation code:
x
 
class A {
  execute() {
    
  }
  
  callback1() {}
  
  callback2() {}
}
window.a = new A();
Tests:
  • bind

     
    a.execute = function () {
      let bound1 = this.callback1.bind(this);
      let bound2 = this.callback2.bind(this);
        
      bound1();
      bound2();
    }
    a.execute();
  • arrow

     
    a.execute = function () {
      let bound1 = () => this.callback1();
      let bound2 = () => this.callback2();
        
      bound1();
      bound2();
    }
    a.execute();