lodash vs es6 - filter then includes method4
Date tested:
2 years ago
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36
Test name
Executions per second
lodash filter then includes method
620088.4 Ops/sec
es6 filter then includes method
3369.2 Ops/sec
Benchmark definition (click to collapse):
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
var array = new Array(10000).fill().map((v, i) => i);
Tests:
lodash filter then includes method
var result = _.chain(array).map((v) => v + 1) .filter((v) => v % 3 === 0) .slice(0, 10).value();
es6 filter then includes method
var result = array.map((v) => v + 1) .filter((v) => v % 3 === 0) .slice(0, 10);
Open this result on MeasureThat.net