Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Array.from vs native from
(version: 1)
Comparing performance of:
Array.from vs native from
Created:
10 months ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
function from1(ArrayLike, map, thisArg) { return 'length' in ArrayLike ? map ? [].map.call(ArrayLike, map, thisArg) : [].slice.call(ArrayLike) : map ? Array.from(ArrayLike, map, thisArg) : [...ArrayLike] } let from2 = Array.from let arr = Array.from({length:1e3},(a,i)=>i), set = new Set(arr), generic = {length: 1e3}
Tests:
Array.from
from2(arr) from2(set) from2(generic)
native from
from1(arr) from1(set) from1(generic)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Array.from
native from
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
9 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:141.0) Gecko/20100101 Firefox/141.0
Browser/OS:
Firefox 141 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Array.from
55712.6 Ops/sec
native from
129307.6 Ops/sec
Related benchmarks:
Array for vs. map push
recreate array vs set
123456qqq
JS Loops tst
Create Array of length 10, where each element is an empty array
Comparação entre maps
splice vs slice
goieqnoigneq
Array.from vs map 1
Comments
Confirm delete:
Do you really want to delete benchmark?