Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
flatmap vs reduce t
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Browser:
Chrome 131
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
flatmap
198.8 Ops/sec
reduce
191.4 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
/*your preparation JavaScript code goes here To execute async code during the script preparation, wrap it as function globalMeasureThatScriptPrepareFunction, example:*/ let a = Array.from({ length: 10000 }, (v, i) => ({ name: i, station: Array.from({ length: 20 }, (v2, i2) => i2) }) )
Tests:
flatmap
/*When writing async/deferred tests, use `deferred.resolve()` to mark test as done*/ a.flatMap((l) => l.station.map(s=>({line:l.name,station:s})))
reduce
a.reduce((acc,curr) => (curr.station.map(s=>acc.push({line:curr.name,station:s})),acc),[])