Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
flatmap vs reduce for building arrays
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36
Browser:
Chrome 149
Operating system:
Ubuntu
Device Platform:
Desktop
Date tested:
one month ago
flatMap
3K/s
reduce
8/s
View exact numbers
Test name
Executions per second
✓
flatMap
3,356 Ops/sec
reduce
8 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
var array = Array(10_000).fill({ id: 1 })
Tests:
flatMap
array.flatMap(({id})=>[id])
reduce
array.reduce((acc, {a})=>[...acc,a],[])