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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Browser:
Chrome 131
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Spread
415.2 Ops/sec
FlatMap
249.5 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 }, ])