Test name | Executions per second |
---|---|
Native | 6784802.0 Ops/sec |
Lodash.js filter | 2542278.0 Ops/sec |
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.4/lodash.min.js"></script>
var max1 = 100000; // 100,000 (100 Thousand)
var max2 = 10000000; // 10,000,000 (10 Million)
var max3 = 100000000; // 100,000,000 (100 Million)
var arr1 = [];
//for (var i = 0; i <= max1; i++) { arr1.push(i); }
var arr2 = [];
for (var i = 0; i <= max2; i++) { arr2.push(i); }
var arr3 = [];
//for (var i = 0; i <= max3; i++) { arr3.push(i); }
arr3.filter(el => el % 10);
_.filter(arr3, (el) => el % 10);