HTML Preparation code:
AخA
 
1
<script src="https://cdn.jsdelivr.net/lodash/4.17.15/lodash.min.js"></script>
Script Preparation code:
 
var values = [{a: 30310}, {b: 100303}, {c: 3040494}]
Tests:
  • lodash.forEach

     
    var count = 0;
    _.forEach(values, function(v,i) {
      if (v.a != null) {
        count++; 
      }
    })
  • native for

     
    var count = 0;
    for (var i = 0; i < values.length; i++) {
      if (values[i].a != null) {
        count++; 
      }
    }
  • native forEach

     
    var count = 0;
    values.forEach(function(v) {
      if (v.a != null) {
        count++; 
      }
    })
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    lodash.forEach
    native for
    native forEach

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 days ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Chrome 131 on Linux
View result in a separate tab
Test name Executions per second
lodash.forEach 13889835.0 Ops/sec
native for 36407964.0 Ops/sec
native forEach 43297812.0 Ops/sec