Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Lodash flatMap vs map reduce
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/125.0.0.0 Safari/537.36
Browser:
Chrome 125
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
FlatMap
6702894.0 Ops/sec
Reduce
2977935.5 Ops/sec
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/lodash/4.16.0/lodash.min.js"></script>
Script Preparation code:
var x = [ { "id": "1", "coordinates": { "latitude": 1, "longitude": 1 }, "cells": [ { "cellGlobalIdentifier": "00001", "id": "0000000001", "locationName": "Loc A Loc B Loc C", "coordinates": { "latitude": 10.000000, "longitude": 10.000000 } } ], "cgis": ["0000100000001"], "laccellIds": ["0000000001"] }, { "id": "10.0001#10.0002", "coordinates": { "latitude": 10.0001, "longitude": 10.0002 }, "cells": [ { "cellGlobalIdentifier": "00002", "lacOrTac_CellId": "0000000002", "locationName": "Loc D Loc E Loc F", "coordinates": { "latitude": 10.0001, "longitude": 10.0002 } } ], "cgis": ["0000200000002"], "laccellIds": ["0000000002"] }, { "id": "10.0003#10.0004", "coordinates": { "latitude": 10.0003, "longitude": 10.0004 }, "cells": [ { "cellGlobalIdentifier": "00003", "lacOrTac_CellId": "0000000003", "locationName": "Loc G Loc H Loc I", "coordinates": { "latitude": 10.0003, "longitude": 10.0004 } } ], "cgis": ["0000300000003"], "laccellIds": ["0000000003"] }, { "id": "10.0005#10.0006", "coordinates": { "latitude": 10.0005, "longitude": 10.0006 }, "cells": [ { "cellGlobalIdentifier": "00004", "lacOrTac_CellId": "0000000004", "locationName": "Loc J Loc K Loc L", "coordinates": { "latitude": 10.0005, "longitude": 10.0006 } } ], "cgis": ["0000400000004"], "laccellIds": ["0000000004"] }, { "id": "10.0007#10.0008", "coordinates": { "latitude": 10.0007, "longitude": 10.0008 }, "cells": [ { "cellGlobalIdentifier": "00005", "lacOrTac_CellId": "0000000005", "locationName": "Loc M Loc N Loc O", "coordinates": { "latitude": 10.0007, "longitude": 10.0008 } } ], "cgis": ["0000500000005"], "laccellIds": ["0000000005"] }, { "id": "10.0009#10.0010", "coordinates": { "latitude": 10.0009, "longitude": 10.0010 }, "cells": [ { "cellGlobalIdentifier": "00006", "lacOrTac_CellId": "0000000006", "locationName": "Loc P Loc Q Loc R", "coordinates": { "latitude": 10.0009, "longitude": 10.0010 } }, { "cellGlobalIdentifier": "00007", "lacOrTac_CellId": "0000000007", "locationName": "Loc S Loc T Loc U", "coordinates": { "latitude": 10.0009, "longitude": 10.0010 } }, { "cellGlobalIdentifier": "00008", "lacOrTac_CellId": "0000000008", "locationName": "Loc V Loc W Loc X", "coordinates": { "latitude": 10.0009, "longitude": 10.0010 } } ], "cgis": ["0000600000006", "0000700000007", "0000800000008"], "laccellIds": ["0000000006", "0000000007", "0000000008"] } ];
Tests:
FlatMap
_.flatMap(x, y => y.cgis)
Reduce
x.map(cellSite => cellSite.cgis).reduce((acc, cgisList) => acc.concat(cgisList), []);