Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array.from vs forEach (mytest)
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 131
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Array.from
705K/s
forEach
40K/s
View exact numbers
Test name
Executions per second
✓
Array.from
704,676 Ops/sec
forEach
40,489 Ops/sec
Script Preparation code:
var fooSet = new Set(); for(var i=0;i<100;i++) { fooSet.add(i); } var other = [];
Tests:
Array.from
other = Array.from(fooSet);
forEach
fooSet.forEach(foo => other.push(foo));