Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/111.0
Firefox 111
Linux
Desktop
one year ago
Test name Executions per second
Lodash 388.3 Ops/sec
Native 866.6 Ops/sec
HTML Preparation code:
x
 
1
2
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
 
var max2 = 100000;
var data = [];
for (var i = 0; i <= max2; i++) { data.push({ id: i }); }
Tests:
  • Lodash

     
    _.groupBy(data, ({ id }) => id)
  • Native

     
    data.reduce((acc, item) => {
            acc[item.id] = item;
            return acc;
    }, {})