Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
flatmap vs reduce for building arrays for objects
(version: 1)
Comparing performance of:
flatMap vs reduce
Created:
one month ago
by:
Registered User
Go to the latest result
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}),{})
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
flatMap
reduce
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one month ago
)
User agent:
Mozilla/5.0 (Android 16; Mobile; rv:152.0) Gecko/152.0 Firefox/152.0
Browser/OS:
Firefox Mobile 152 on Android
View result in a separate tab
Embed
Embed Benchmark Result
flatMap
860/s
reduce
416/s
View exact numbers
Test name
Executions per second
✓
flatMap
860 Ops/sec
reduce
416 Ops/sec
Related benchmarks
Object.fromEntries(Array.map) vs Array.reduce (with different methods)
flatmap vs reduce for building arrays
fromEntries vs reduce for building objects
Comments
Confirm delete:
Do you really want to delete benchmark?