Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array.from vs array destructure 2
(version: 1)
Comparing performance of:
Array.from vs array destructure
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
var arr = Array(10000).fill(null).map((_, index) => index);
Tests:
Array.from
const newArr1 = Array.from({ length: 10_000 }).map((_, index) => index);
array destructure
const newArr2 = [...Array(10_000)].map((_, index) => index);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Array.from
array destructure
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Browser/OS:
Chrome 132 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Array.from
5041.8 Ops/sec
array destructure
41211.9 Ops/sec
Related benchmarks:
for vs map to fill array
for vs map to fill array fixed
recreate array vs set
Map vs preallocation
Array.map vs preallocation
fill vs map
Array.from() vs new Array() vs [..Array()]
js array copy speed comparison...
Array.from vs array destructure
Comments
Confirm delete:
Do you really want to delete benchmark?