HTML Preparation code:
AخA
 
1
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
x
 
const getRandomChar = () => String.fromCharCode(Math.floor(Math.random() * 26) + 97);
const getRandomString = () => Array(Math.floor(Math.random() * 10) + 1).fill().map(getRandomChar).join('');
var values = Array(1000000).fill().map(getRandomString);
var valueToFind = values[650249];
Tests:
  • Native Array.find

     
    const nativeFoundValue = values.find((val) => val === valueToFind);
  • Lodash _.find

     
    const lodashFoundValue = _.find(values, (val) => val === valueToFind);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Native Array.find
    Lodash _.find

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
Chrome 116 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Native Array.find 267867.5 Ops/sec
Lodash _.find 263856.6 Ops/sec