Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
for loop vs. .map [4]
(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 theArr =[1,2];
Tests:
.map
for (let i=0;i<theArr.length; i++) { theArr[i] = theArr[i]+2; }
for loop
theArr = theArr.map( (theEl)=>theEl+1 ).map( (theEl)=>theEl+1 );
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:
2 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36
Browser/OS:
Chrome 144 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
.map
60641788.0 Ops/sec
for loop
5184484.0 Ops/sec
Related benchmarks:
For loop map vs map builtin for 10000000 elements
For loop map vs map builtin for 100000 elements
Array loop vs foreach vs map noFx_1k
Map vs Obj12332
For + Push vs Map
Map looping
Map loop
Map looping2
For loop vs For of vs Map()
Comments
Confirm delete:
Do you really want to delete benchmark?