Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
for vs for of3
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Browser:
Chrome 120
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
for
8.3 Ops/sec
for of
98.7 Ops/sec
Script Preparation code:
var count = 1000 * 1000 var data = []; do { data.push(count); } while(--count);
Tests:
for
let counter = 0; for (var index = 0; index < data.length; index++) { var obj = data[index]; if (obj == obj) counter++; }
for of
let counter = 0; for (const obj of data) { if (obj == obj) counter++; }