Bound test

Benchmark created on


Setup

class Test {
  constructor(a, b) {
    this.a = a;
    this.b = b;
  
    this.boundAdd = this.add.bind(this);
  }
    
  add() {
    return this.a + this.b;
  }
  
  callArrow() {
    return call(() => this.add());
  }
    
  callBound() {
    return call(this.boundAdd);
  }
}

function call(cb) {
  return cb();
}

const t = new Test();

Test runner

Ready to run.

Testing in
TestOps/sec
Arrow
t.callArrow()
ready
Bound
t.callBound()
ready

Revisions

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