Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36
Chrome 101
Linux
Desktop
2 years ago
Test name Executions per second
Native 1.5 Ops/sec
Lodash 1.8 Ops/sec
HTML Preparation code:
AخA
 
1
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js"></script>
Script Preparation code:
x
 
const limit = 10000000;
var array = [];
for (let i = 0; i < limit; i++) {
  array.push(i);
}
function getRandomIndex() {
  return Math.floor(Math.random() * array.length)
}
var element = array[getRandomIndex()];
Tests:
  • Native

     
    array.filter(x => x === element);
  • Lodash

     
    _.remove(array, x => x === element);