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 obj = Array.from({ length: 10000 }).map((value, i) => i).reduce((val, v) => { val[v] = v; return val; }, {})
Tests:
  • lodash.each

     
    _.each(obj, function(v, k) {})
  • lodash.map

     
    _.map(obj, function(v, k) {})
  • Object.entries.map

     
    Object.entries(obj).map(function([k, v]) {})
  • vanilla for-loop w/ Object.entries

     
    const entries = Object.entries(obj);
    for (let i = 0; i < entries.length; i++) { const [k, v] = entries[i]; }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    lodash.each
    lodash.map
    Object.entries.map
    vanilla for-loop w/ Object.entries

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 4 months ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.1.1 Safari/605.1.15
Safari 18 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
lodash.each 1098.2 Ops/sec
lodash.map 985.9 Ops/sec
Object.entries.map 959.2 Ops/sec
vanilla for-loop w/ Object.entries 808.6 Ops/sec