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:
5 months ago
by:
Guest
Go 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:
5 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
.map
60.6M/s
for loop
5.2M/s
View exact numbers
Test name
Executions per second
✓
.map
60,641,788 Ops/sec
for loop
5,184,484 Ops/sec
Comments
Confirm delete:
Do you really want to delete benchmark?