Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
for loop vs. .map 100k
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/134.0.0.0 Safari/537.36
Browser:
Chrome 134
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
.map
897.5 Ops/sec
for loop
643.8 Ops/sec
Script Preparation code:
// Create sample data const array = Array.from({ length: 100000 }, () => Math.floor(Math.random() * 1_000_000)); var manipulateFn = num => { return num * 2 * 3; }
Tests:
.map
var newArray = array.map( i => manipulateFn(i));
for loop
var newArray = []; for (let i=0; i<array.length; i++) { newArray.push(manipulateFn(array[i])); }