Array.prototype.filter vs Lodash without 3
Date tested:
one year ago
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36
Test name
Executions per second
Array.prototype.filter
992.2 Ops/sec
Lodash without
772.8 Ops/sec
Slice
777.5 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); return [...array.slice(0, index), ...array.slice(index + 1)];
Open this result on MeasureThat.net