Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
for vs forEach vs some vs for..of vs for..in
Compare loop performance
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Browser:
Chrome 134
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
for
965846.7 Ops/sec
foreach
3683488.8 Ops/sec
some
1826720.2 Ops/sec
for..of
3725722.5 Ops/sec
for..in
60997.2 Ops/sec
Script Preparation code:
var array = new Array(1000).fill(0);
Tests:
for
for (let i = 0, length = array.length; i < length; i++) { array[i] }
foreach
array.forEach(item => item);
some
array.some(item => item);
for..of
for (let item of array) { item }
for..in
for (let i in array) { array[i] }