Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
different ways to loop
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:124.0) Gecko/20100101 Firefox/124.0
Browser:
Firefox 124
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
for
58879.0 Ops/sec
for-of
14399.6 Ops/sec
Script Preparation code:
var arr = [...new Array(10000)].map(() => Math.random());
Tests:
for
let sum = 0; for (let i = 0; i < arr.length; i++) { sum += arr[i]; }
for-of
let sum = 0; for (const x of arr) { sum += x; }