Script Preparation code:
x
 
var arr = [];
var i = 0;
while (i <= 1E5) arr[i] = i++;
Tests:
  • Array.find

     
    const item = arr.find(i => i == 1E5)
  • for loop

     
    let index = 0
    for (let i = 0; i < arr.length; i++) {
      const item = arr[i]
      if (item == 1E5) {
        index = i
        break
      } else {
        continue
      }
    }
    const item = arr[index]
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Array.find
    for loop

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.109 Safari/537.36
Chrome 98 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Array.find 897.7 Ops/sec
for loop 81.6 Ops/sec