Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Direct calls versus external function calls
(version: 1)
Compares doing little tasks immediately versus writing a helper function that does it.
Comparing performance of:
Direct calls vs Function calls
Created:
one year ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const tabs = { one: { label: 'One' }, two: { label: 'Two' }, three: { label: 'Three' }, four: { label: 'Four' } } function fetchDataForTab(tabName) {} function handleData(data, handler) { // performance optimized const tabNames = Object.keys(data) for (let i = 0; i < tabNames.length; i++) { handler(tabNames[i]) } }
Tests:
Direct calls
// performance optimized const tabNames = Object.keys(tabs) for (let i = 0; i < tabNames.length; i++) { fetchDataForTab(tabNames[i]) }
Function calls
handleData(tabs, fetchDataForTab)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Direct calls
Function calls
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 18_2_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.2 Mobile/15E148 Safari/604.1
Browser/OS:
Mobile Safari 18 on iOS 18.2.1
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Direct calls
133584120.0 Ops/sec
Function calls
76562056.0 Ops/sec
Related benchmarks:
Direct call vs bind vs call vs apply vs self
Function Call vs Inline 1
Inline return, newline undefined return
function vs const
Function vs Eval vs Getter
Calling a function inside whatever
call self vs inline
function object vs function
Loop through object keys
Comments
Confirm delete:
Do you really want to delete benchmark?