CORRECTED: Filter-Map: Lodash vs Native
Date tested:
9 months ago
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36
Test name
Executions per second
Native filter-map
48.9 Ops/sec
Lazy Lodash filter-map
44.8 Ops/sec
Benchmark definition (click to collapse):
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
Script Preparation code:
var data = Array(1000000).fill({ filtering: true, mapping: 42 });
Tests:
Native filter-map
data.filter(({ filtering }) => filtering).map(({ mapping }) => mapping)
Lazy Lodash filter-map
_(data).filter('filtering').map('mapping').value()
Open this result on MeasureThat.net