Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Spread vs FlatMap w/40K data
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
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:
Chrome Mobile 132
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
Spread
88.5 Ops/sec
FlatMap
79.9 Ops/sec
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 }, ])