Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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
Benchmark engine:
Benchmark.js
for
59K/s
for-of
14K/s
View exact numbers
Test name
Executions per second
✓
for
58,879 Ops/sec
for-of
14,400 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; }