Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
flatMap() vs filter().map() 999
(version: 1)
flatMap vs filter map
Comparing performance of:
filter().map() vs flatMap()
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
var arr = []; var i = 0; while (i <= 1E5) arr[i] = i++;
Tests:
filter().map()
arr.filter(x => x % 3).map(x => x/100)
flatMap()
arr.flatMap(x => x % 3 ? [x/100] : [])
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
filter().map()
flatMap()
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Browser/OS:
Chrome 131 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
filter().map()
456.8 Ops/sec
flatMap()
390.6 Ops/sec
Related benchmarks:
flatMap() vs filter().map()
flatmap vs filter-map
flatMap() vs map().filter()
Array flatMap() vs filter().map()
flatMap() vs filter().map() small
flatMap() vs map().filter() small
flatMap() vs filter().map() 2
flatMap() vs filter() oof
flatMap() vs filter().map() 1
flatMap() vs filter().map() v3
Comments
Confirm delete:
Do you really want to delete benchmark?