Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Spread vs FlatMap w/40K data
(version: 1)
Comparing performance of:
Spread vs FlatMap
Created:
one year ago
by:
Guest
Go to the latest result
Script Preparation code:
const arr = Array.from({ length: 40000 }).map((_, index) => ({ id: index, label: `lbl`, plate: `plt` }));
Tests:
Spread
let x = [...arr?.map((item) => ({ ...item, label: item.label, value: item.id, })), ...arr?.map((item) => ({ ...item, label: item.plate, value: item.id, })),]
FlatMap
let y = arr?.flatMap((item) => [ { ...item, label: item.label, value: item.id }, { ...item, label: item.oldLicensePlate, value: item.id }, ])
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Spread
FlatMap
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.6834.56 Mobile Safari/537.36
Browser/OS:
Chrome Mobile 132 on Android
View result in a separate tab
Embed
Embed Benchmark Result
Spread
89/s
FlatMap
80/s
View exact numbers
Test name
Executions per second
✓
Spread
89 Ops/sec
FlatMap
80 Ops/sec
Related benchmarks
Array push vs map v1
map vs for of
flatmap vs concat and spread operator
simple array and map vs forEach vs for by cuteLuna v4
for of vs flatmap vs reduce 2
Comments
Confirm delete:
Do you really want to delete benchmark?