Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Direct call vs bind vs closure 2
(version: 1)
Comparing performance of:
Explicit parameters vs New parameter object
Created:
7 months ago
by:
Guest
Go to the latest result
Script Preparation code:
function f1(self) { var m = self.msg; return m; } function f2() { var m = this.msg; return m; } var m = { msg: "Hello" }; var z = (() => f1(m)); var t = new Function("", ` var x = this.x; return x; `).bind({ msg: "Hello" }); for (let i = 0; i < 1000; i++) { t(); }
Tests:
Explicit parameters
z()
New parameter object
t()
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Explicit parameters
New parameter object
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
7 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0
Browser/OS:
Chrome 143 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Explicit parameters
183.6M/s
New parameter object
182.0M/s
View exact numbers
Test name
Executions per second
✓
Explicit parameters
183,640,512 Ops/sec
New parameter object
182,020,992 Ops/sec
Related benchmarks
Bind vs closure declaration
Direct call vs bind vs call vs apply vs self
Direct call vs saved bind vs inline bind vs call vs apply vs closure
Direct call vs bind vs call vs apply vs static bound
Arrow call vs bind vs call vs apply with bound options
Comments
Confirm delete:
Do you really want to delete benchmark?