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/148.0.0.0 Safari/537.36
Browser:
Chrome 148
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 months ago
Benchmark engine:
Benchmark.js
for loop
936K/s
Array.from()
813K/s
View exact numbers
Test name
Executions per second
✓
for loop
935,815 Ops/sec
Array.from()
813,268 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;