Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
flatmap vs reduce for building arrays for objects
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Android 16; Mobile; rv:152.0) Gecko/152.0 Firefox/152.0
Browser:
Firefox Mobile 152
Operating system:
Android
Device Platform:
Mobile
Date tested:
one month ago
flatMap
860/s
reduce
416/s
View exact numbers
Test name
Executions per second
✓
flatMap
860 Ops/sec
reduce
416 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
var array = Array(10_000).fill({ id: 1 })
Tests:
flatMap
Object.fromEntries(array.flatMap((obj)=>[[obj.id,obj]]))
reduce
array.reduce((acc, obj)=>({...acc, [obj.id]: obj}),{})