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
direct call
82K/s
apply
80K/s
call
78K/s
bind
77K/s
method call
72K/s
View exact numbers
Test name
Executions per second
✓
direct call
81,633 Ops/sec
apply
79,516 Ops/sec
call
77,935 Ops/sec
bind
76,644 Ops/sec
method call
72,079 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")