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
Go 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
filter().map()
457/s
flatMap()
391/s
View exact numbers
Test name
Executions per second
✓
filter().map()
457 Ops/sec
flatMap()
391 Ops/sec
Related benchmarks
flatMap() vs filter().map()
Array flatMap() vs filter().map()
flatMap() vs filter().map() v3
Comments
Confirm delete:
Do you really want to delete benchmark?