Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
for i vs for of entries
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
Browser:
Chrome 128
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
For i
26456.3 Ops/sec
for of entries
197902.9 Ops/sec
Script Preparation code:
var array = [...Array.from({length: 1_000}).keys()]
Tests:
For i
let count = 0; for (let i = 0; i < array.length; i += 1) { count += 1; } console.log(count);
for of entries
let count = 0; for (const [index, item] of array.entries()) { count += 1; } console.log(count);