Array.prototype.filter vs Lodash without 4
Date tested:
one year ago
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.114 Safari/537.36 OPR/89.0.4447.64 (Edition GX-CN)
Test name
Executions per second
Array.prototype.filter
1249.1 Ops/sec
Lodash without
1049.4 Ops/sec
Slice
544.6 Ops/sec
Benchmark definition (click to collapse):
HTML Preparation code:
<script src="lodash.js"></script>
Script Preparation code:
var array = [...Array(100000).keys()];
Tests:
Array.prototype.filter
array.filter(n => n === 999)
Lodash without
_.without(array, 999)
Slice
const index = array.indexOf(999); [...array.slice(0, index), ...array.slice(index + 1)];
Open this result on MeasureThat.net