HTML Preparation code:
x
 
1
2
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.js'></script>
Script Preparation code:
 
var array = [];
var i = 0;
while (i < 1000) {
  array.push(i++);
}
Tests:
  • Array.forEach

     
    array.forEach(function (element, index) {
      console.log(index + " " + element);
    });
  • $.each

     
    $.each(array, function (index, element) {
      console.log(index + " " + element);
    });
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Array.forEach
    $.each

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0
Firefox 78 on Windows
View result in a separate tab
Test name Executions per second
Array.forEach 20.5 Ops/sec
$.each 21.0 Ops/sec