Run details:
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0
Firefox 61
Windows 7
Desktop
6 years ago
Test name Executions per second
Native find 39342480.0 Ops/sec
Lodash find 7893685.0 Ops/sec
Lodash some 3506421.8 Ops/sec
Native some 38422060.0 Ops/sec
Native find index 33303154.0 Ops/sec
Complex 11148775.0 Ops/sec
HTML Preparation code:
AخA
 
1
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.10/lodash.core.js"></script>
Script Preparation code:
 
var selected = [{ id: '1' }, { id: '2' }, { id: '3' }];
Tests:
  • Native find

     
    var found = selected.find(m => m.id === '3');
  • Lodash find

     
    var found = _.find(selected, m => m.id === '3');
  • Lodash some

     
    var found = _.some(selected, m => m.id === '3')
  • Native some

     
    var found = selected.some(m => m.id === '3')
  • Native find index

     
    var found = selected.findIndex(m => m.id === '3')
  • Complex

     
    var indexes = selected.map(s => s.id);
    var found = selected.includes('3');