Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Map.foreach vs Map.for..of with func
Compare loop performance
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/140.0.0.0 Safari/537.36
Browser:
Chrome 140
Operating system:
Windows
Device Platform:
Desktop
Date tested:
8 months ago
Test name
Executions per second
foreach
9163.4 Ops/sec
for..of
7938.0 Ops/sec
Script Preparation code:
var mapV = new Map([[1, 1], [2, 1],[3, 1],[4, 1],[5, 1],[6, 1],[7, 1],[8, 1],[9, 1],[10, 1],[11, 1],[12, 1],[13, 1],[14, 1],[15, 1],[16, 1],[17, 1],[18, 1],[19, 1],[20, 1],[21, 1],[22, 1],[23, 1],[24, 1],[25, 1]]);
Tests:
foreach
mapV.forEach(function(value, key) { console.info(value + key); });
for..of
for (var [key, value] of mapV) { console.info(value + key); }