Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Passing existing array vs spreading twice
(version: 0)
Comparing performance of:
Passing array directly to second function vs Spreading array an extra time
Created:
4 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
data = [...Array(1000).keys()]
Tests:
Passing array directly to second function
function first(...data){ const res = data.map((n)=> parseInt(n)) return second(res) } function second(data){ const reducer = (acc, n)=> acc + n return data.reduce(reducer, 0) } first(...data)
Spreading array an extra time
function first(...data){ const res = data.map((n)=> parseInt(n)) return second(...res) } function second(...data){ const reducer = (acc, n)=> acc + n return data.reduce(reducer, 0) } first(...data)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Passing array directly to second function
Spreading array an extra time
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
JavaScript spread operator vs Object.assign performance to merge into new object
JavaScript spread operator vs Object.assign performance with empty object as first key
JavaScript spread operator vs Object.assign performance (same behaviour)
JavaScript spread operator vs Object.assign performance (create new objects)
JavaScript spread operator vs Object.assign vs different spread performance v2
Comments
Confirm delete:
Do you really want to delete benchmark?