Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
for loop vs. .map 100k
(version: 1)
Comparing performance of:
.map vs for loop
Created:
one year ago
by:
Guest
Go to the latest result
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])); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
.map
for loop
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
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/OS:
Chrome 134 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
.map
897/s
for loop
644/s
View exact numbers
Test name
Executions per second
✓
.map
897 Ops/sec
for loop
644 Ops/sec
Related benchmarks
for loop vs. .map
for loop vs. .map [2]
for loop vs. .map but fast
for loop vs. .map anon
for loop vs. .map anon2
for of loop vs. .map
for loop vs. .map with size
asdfasdfqer
Comments
Confirm delete:
Do you really want to delete benchmark?