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:
 
var arr = _.range(10000)
Tests:
  • for loop

     
    for(let i = 0; i < arr.length; i++) {}
  • Array.prototype.forEach

     
    arr.forEach(ele => {})
  • lodash each

     
    _.forEach(arr, ele => {})
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    for loop
    Array.prototype.forEach
    lodash each

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 5 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.120 Safari/537.36
Chrome 77 on Mac OS X 10.15.3
View result in a separate tab
Test name Executions per second
for loop 1633.5 Ops/sec
Array.prototype.forEach 19314.9 Ops/sec
lodash each 8705.3 Ops/sec