Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array(1,000,000 length) Mapping | Array.from vs Spread
(version: 2)
Comparing performance of:
Array.from vs Spread
Created:
one year ago
by:
Registered User
Jump to the latest result
Script Preparation code:
const largeArray = []; for (let i = 0; i < 1_000_000; i++) { largeArray.push(i); }
Tests:
Array.from
const arrFromMapped = Array.from(largeArray, x => x * 2);
Spread
const arrSpreadMapped = [...largeArray].map(x => x * 2);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Array.from
Spread
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Mobile Safari/537.36
Browser/OS:
Chrome Mobile 131 on Android
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Array.from
11.7 Ops/sec
Spread
29.2 Ops/sec
Related benchmarks:
Array.apply vs Spread new array
Array.from vs Spread with undefined and map
Javascript string to array mapping: Array.from() vs Spread syntax [...spread]
Array.from vs Array spread with mapping of values
Array from vs Spread es6
spread vs push 3
js array copy speed comparison and spread operator
Array(1,000,000 length) Convert | Array.from vs Spread
Set(1,000,000 length) Convert | Array.from vs Spread
Comments
Confirm delete:
Do you really want to delete benchmark?