Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Get array from iterable with Array.from() vs for loop
Array.from is notoriously slow. This compares creating an Array from an iterable with Array.from() vs a for loop.
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/152.0.0.0 Safari/537.36
Browser:
Chrome 152
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
10 days ago
Benchmark engine:
Benchmark.js
for loop
650K/s
Array.from()
536K/s
View exact numbers
Test name
Executions per second
✓
for loop
649,522 Ops/sec
Array.from()
535,656 Ops/sec
Tests:
Array.from()
var iterable = document.all,a = Array.from(iterable)
for loop
for(var iterable=document.all,a=Array(iterable.length),iterator=iterable[Symbol.iterator](),i=0,next;!(next=iterator.next()).done;)a[i++]=next.value;