Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
lodash groupBy vs Array.reduce 500k
(version: 0)
Comparing performance of:
Lodash vs Native
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
var max2 = 500000; var data = []; for (var i = 0; i <= max2; i++) { data.push({ id: i }); }
Tests:
Lodash
_.groupBy(data, ({ id }) => id)
Native
// Using reduce to mimic _.groupBy const grouped = data.reduce((acc, item) => { // Initialize an array for this id if it doesn't exist if (!acc[item.id]) acc[item.id] = []; // Push the item into the array for this id acc[item.id].push(item); return acc; }, {});
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Lodash
Native
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36 Edg/130.0.0.0
Browser/OS:
Chrome 130 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Lodash
68.3 Ops/sec
Native
40.3 Ops/sec
Related benchmarks:
lodash groupBy vs Array.reduce (1mln)
lodash groupBy vs Array.reduce on million items
lodash groupBy vs Array.reduce [correct] 100k
lodash groupBy vs Array.reduce 100k corrected
lodash groupBy vs Array.reduce 100
lodash groupBy vs Array.reduce grouping
lodash groupBy vs Array.reduce 100k better
lodash groupBy vs Array.reduce group by 100k
lodash groupBy vs group with Array.reduce 100k
Comments
Confirm delete:
Do you really want to delete benchmark?