Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
copy typed array with Array.from() vs new Array()
(version: 1)
Testing the difference between creating filled arrays.
Comparing performance of:
new Array() vs Array.from()
Created:
one month ago
by:
Guest
Go to the latest result
Tests:
new Array()
const ary = new Uint32Array(1000); const res = new Array(1000); for (let i = 0; i < ary.length; ++i) { res[i] = ary[i]; }
Array.from()
const ary = new Uint32Array(1000); const res = Array.from(ary);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
new Array()
Array.from()
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one month ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36
Browser/OS:
Chrome 149 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
new Array()
254K/s
Array.from()
38K/s
View exact numbers
Test name
Executions per second
✓
new Array()
254,443 Ops/sec
Array.from()
37,652 Ops/sec
Related benchmarks
array vs int32array2
array vs int32array3
Array vs Typed Array vs Buffer Typed Array
Array vs TypedArray write performance
Hardcoded Array vs Array.from() vs new Array() vs push
Array vs TypedArray write performance ttttttt
Array vs TypedArray write performance (Int32Array)
Comments
Confirm delete:
Do you really want to delete benchmark?