Tests:
  • For-loop

    AخA
     
    var arr = ['hello', 'a', 'b'];
    let val;
    for(i=0; i<arr.length; i++){
      var value = arr[i];
      if (value === 'b') {
        val = value;
        break;
       }
    }
  • For-Of

     
    var arr = ['hello', 'a', 'b'];
    let val;
    for (var value of arr) {
      if (value === 'b') {
        val = value;
        break;
      }
    }
  • Array.find

     
    var arr = ['hello', 'a', 'b'];
    let val = arr.find(node => node === 'b');
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    For-loop
    For-Of
    Array.find

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 years ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36 OPR/83.0.4254.54
Opera 83 on Linux
View result in a separate tab
Test name Executions per second
For-loop 75781216.0 Ops/sec
For-Of 89141696.0 Ops/sec
Array.find 99229200.0 Ops/sec