Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
set vs array iteration + for each - large arrays
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0
Browser:
Firefox 152
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one month ago
Array for Each
54K/s
array
44K/s
Set for Each
32K/s
set
14K/s
View exact numbers
Test name
Executions per second
✓
Array for Each
53,713 Ops/sec
array
44,295 Ops/sec
Set for Each
31,559 Ops/sec
set
14,383 Ops/sec
Script Preparation code:
const base = Array.from(Array(10000).keys()) var a = base.map(Math.random); var b = new Set(base.map(Math.random)) var c = new Set(base.map(Math.random)) var d = base.map(Math.random);
Tests:
array
for (const x of a) {}
set
for (const x of b) {}
Array for Each
d.forEach(_ => _)
Set for Each
c.forEach(_ => _)