Test name | Executions per second |
---|---|
bind | 2366235.5 Ops/sec |
arrow | 2346935.8 Ops/sec |
class A {
execute() {
}
callback1() {}
callback2() {}
}
window.a = new A();
a.execute = function () {
let bound1 = this.callback1.bind(this);
let bound2 = this.callback2.bind(this);
bound1();
bound2();
}
a.execute();
a.execute = function () {
let bound1 = () => this.callback1();
let bound2 = () => this.callback2();
bound1();
bound2();
}
a.execute();