Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
for loop vs. .map [3]
(version: 1)
Comparing performance of:
.map vs for loop
Created:
2 months ago
by:
Guest
Jump to the latest result
Script Preparation code:
// Create sample data var array = [1,2,3,4,5,6,7,8,9,0]; var manipulateFn = num => { return num * 2 * 3; }
Tests:
.map
var newArray = array.map( i => manipulateFn(i));
for loop
var newArray = []; var arrLength = array.length var i for (i=0; i<arrLength; i++) { 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:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?