Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Push with if vs Map with filter
(version: 0)
Benchmark.js
Comparing performance of:
Push with if vs map with filter
Created:
2 years ago
by:
Guest
Go to the latest result
Script Preparation code:
var strs = Array.from(new Array(10000)).map(() => 'String concat. ') var result = []
Tests:
Push with if
for (let i = 0; i < strs.length; i++) { if (i % 2 === 0){ result.push(strs[i]) } }
map with filter
result = strs.map((a) => a).filter((a) => a % 2 === 0)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Push with if
map with filter
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 years ago
)
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Mobile Safari/537.36
Browser/OS:
Chrome Mobile 123 on Android
View result in a separate tab
Embed
Embed Benchmark Result
map with filter
2K/s
Push with if
872/s
View exact numbers
Test name
Executions per second
✓
map with filter
1,770 Ops/sec
Push with if
872 Ops/sec
Related benchmarks
foreach push vs map
Push (forEach) vs Map
Comments
Confirm delete:
Do you really want to delete benchmark?