Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
bind vs arrow (test2)
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Browser:
Chrome 136
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
bind
1340.8 Ops/sec
closure
1194.5 Ops/sec
Tests:
bind
class Test { constructor() { this.counter = 0; } fn1() { return this.counter += 1; } fn2() { return this.counter += 2; } fn3() { return this.counter += 3; } fn4() { return this.counter += 4; } } function createSomething() { const instance = new Test(); return [instance.fn1.bind(instance), instance.fn2.bind(instance), instance.fn3.bind(instance), instance.fn4.bind(instance)]; } for (let i = 0; i < 100; i++) { let [a, b, c, d] = createSomething(); for (let j = 0; j < 100; j++) { a(); b(); c(); d(); } }
closure
class Test { constructor() { this.counter = 0; } fn1() { return this.counter += 1; } fn2() { return this.counter += 2; } fn3() { return this.counter += 3; } fn4() { return this.counter += 4; } } function createSomething() { const instance = new Test(); return [() => instance.fn1(), () => instance.fn2(), () => instance.fn3(), () => instance.fn4()]; } for (let i = 0; i < 100; i++) { let [a, b, c, d] = createSomething(); for (let j = 0; j < 100; j++) { a(); b(); c(); d(); } }