Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36
Chrome 106
Mac OS X 10.15.7
Desktop
2 years ago
Test name Executions per second
omit 4880638.5 Ops/sec
filter 5173299.0 Ops/sec
HTML Preparation code:
x
 
1
2
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Tests:
  • omit

     
    const foo = ['field1', 'field2', 'field3', 'field4', 'field5'];
    _.reject(foo, nextField => nextField === 'field4');
  • filter

     
    const foo = ['field1', 'field2', 'field3', 'field4', 'field5'];
    _.filter(foo, nextField => nextField !== 'field4');