Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Direct call vs bind vs call vs apply vs self
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 14_1_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36
Browser:
Chrome 89
Operating system:
Mac OS X 14.1.1
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
direct call
81632.6 Ops/sec
bind
76644.4 Ops/sec
call
77934.7 Ops/sec
apply
79516.3 Ops/sec
method call
72079.3 Ops/sec
Script Preparation code:
function test(msg) { console.log(this, msg); } function test1(self, msg) { console.log(self, msg); } function test2(msg) { console.log(this, msg); } function test3(msg) { console.log(this, msg); } function test4(msg) { console.log(this, msg); } String.prototype.test5 = function(msg) { console.log(this, msg) }
Tests:
direct call
test1("World", "Hello");
bind
test2.bind("World", "Hello")();
call
test3.call("World", "Hello");
apply
test4.apply("World", ["Hello"]);
method call
"World".test5("Hello")