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 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Browser:
Chrome 127
Operating system:
Android
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
For i
10137.7 Ops/sec
for of entries
47493.3 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);