Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
for vs .foreach vs .some vs for..of
Compare loop performance
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:144.0) Gecko/20100101 Firefox/144.0
Browser:
Firefox 144
Operating system:
Ubuntu
Device Platform:
Desktop
Date tested:
11 months ago
Benchmark engine:
Benchmark.js
for
17.8M/s
some
15.5M/s
foreach
8.1M/s
for..of
1.2M/s
View exact numbers
Test name
Executions per second
✓
for
17,817,606 Ops/sec
some
15,458,428 Ops/sec
foreach
8,138,108 Ops/sec
for..of
1,166,485 Ops/sec
Script Preparation code:
let array = new Array(100);
Tests:
for
for (let i = 0; i < array.length; i++) { array[i]; }
foreach
array.forEach((i) => { array[i]; });
some
array.some((i) => { array[i]; });
for..of
for (let i of array) { array[i]; }