Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
flatMap() vs filter()x1.map() vs reduce()
(version: 0)
Comparing performance of:
filter().map() vs flatMap() vs reduce()
Created:
3 years 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 % 12 && x % 5 && x % 3).map(x => x/100)
flatMap()
arr.flatMap(x => x % 12 && x % 5 && x % 3 ? x/100 : [])
reduce()
arr.reduce((newArray, x) => { if (x % 12 && x % 5 && x % 3) { newArray.push(x / 100) } return newArray }, [])
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
filter().map()
flatMap()
reduce()
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
flatMap() vs filter().map() - arrays
flatMap vs reduce vs filter.map
flatMap vs reduce vs filter.map v2
flatMap vs reduce vs loop filtering vs filter/map performance
Reduce Push vs. flatMap vs 123
Comments
Confirm delete:
Do you really want to delete benchmark?