Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
For loop, length, spread set vs For of
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:120.0) Gecko/20100101 Firefox/120.0
Browser:
Firefox 120
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
For of
300/s
Const length
286/s
For loop
264/s
View exact numbers
Test name
Executions per second
✓
For of
300 Ops/sec
Const length
286 Ops/sec
For loop
264 Ops/sec
Script Preparation code:
var set = new Set(Array.from(Array(1000).keys()) .map((x) => `item--${x}`))
Tests:
For of
for (var val of set) { console.log(val); }
Const length
const arr = [...set] let length = arr.length for (let i = 0; i < length; i++) { console.log(arr[i]) }
For loop
const arr = [...set] for (let i = 0; i < arr.length; i++) { console.log(arr[i]) }