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 data100 = _.fill(Array(100), 1).reduce((r, v, i) => (r[`k${i}`] = v, r), {});
var data1000 = _.fill(Array(1000), 1).reduce((r, v, i) => (r[`k${i}`] = v, r), {});
Tests:
  • lodash.each

     
    var sum = 0;
    _.each(data100, (v, k) => sum+=v)
  • Object.entries.forEach

     
    var sum = 0;
    Object.entries(data100).forEach(([v, k]) => sum+=v)
  • for...in

     
    var sum = 0;
    for (let k in data100) { sum+=data100[k]; }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    lodash.each
    Object.entries.forEach
    for...in

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36
Chrome 104 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
lodash.each 209852.4 Ops/sec
Object.entries.forEach 59969.8 Ops/sec
for...in 88752.9 Ops/sec