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
Go 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
Spread
29/s
Array.from
12/s
View exact numbers
Test name
Executions per second
✓
Spread
29 Ops/sec
Array.from
12 Ops/sec
Related benchmarks
Javascript string to array mapping: Array.from() vs Spread syntax [...spread]
Array from vs Spread es6
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?