Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
flatMap() vs filter().map() 1asdasd
flatMap vs filter map
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 18_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.5 Mobile/15E148 Safari/604.1
Browser:
Mobile Safari 26
Operating system:
iOS 18.7
Device Platform:
Mobile
Date tested:
28 days ago
flatMap()
2K/s
filter().map()
2K/s
View exact numbers
Test name
Executions per second
✓
flatMap()
2,289 Ops/sec
filter().map()
1,775 Ops/sec
Script Preparation code:
var arr = []; var i = 0; while (i <= 1E5) arr[i] = i++;
Tests:
filter().map()
arr.filter(x => x % 3) arr.forEach(x => x/100)
flatMap()
arr.flatMap(x => x % 3 ? x : []) arr.forEach(x => x/100)