Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Push with if vs Map with filter
(version: 0)
Comparing performance of:
Push with if vs map with filter
Created:
2 years ago
by:
Guest
Jump 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
Test name
Executions per second
Push with if
872.4 Ops/sec
map with filter
1769.5 Ops/sec
Related benchmarks:
Map Push vs Map return
Push vs Filter
foreach push vs map
Push (forEach) vs Map
Comments
Confirm delete:
Do you really want to delete benchmark?