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
Go 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
array destructure
41K/s
Array.from
5K/s
View exact numbers
Test name
Executions per second
✓
array destructure
41,212 Ops/sec
Array.from
5,042 Ops/sec
Related benchmarks
Map vs preallocation
Array.map vs preallocation
fill vs map
Array.from() vs new Array() vs [..Array()]
Array.from vs array destructure
Comments
Confirm delete:
Do you really want to delete benchmark?