Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
bonkers
(version: 0)
Comparing performance of:
lodash reduce current vs lodash reduce direct vs lodash forEach object assign vs lodash forEach direct vs native forEach object assign vs native forEach direct
Created:
3 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.12/lodash.min.js"></script>
Script Preparation code:
var max1 = 1000; var arr1 = []; for (var i = 0; i <= max1; i++) { arr1.push({ objectID: i.toString(), a: 'b', c: 'd', e: 'f', g: 'h' }); }
Tests:
lodash reduce current
_.reduce(arr1, (memo, item) => ({ ...memo, [item.objectID]: item }), {});
lodash reduce direct
_.reduce(arr1, (memo, item) => { memo[item.objectID] = item; return memo }, {});
lodash forEach object assign
const hits = {}; _.forEach(arr1, item => Object.assign(hits, { [item.objectID]: item }));
lodash forEach direct
const hits = {}; _.forEach(arr1, item => hits[item.objectID] = item);
native forEach object assign
const hits = {}; arr1.forEach(item => Object.assign(hits, { [item.objectID]: item }));
native forEach direct
const hits = {}; arr1.forEach(item => hits[item.objectID] = item);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (6)
Previous results
Fork
Test case name
Result
lodash reduce current
lodash reduce direct
lodash forEach object assign
lodash forEach direct
native forEach object assign
native forEach direct
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
native vs lodash
lodash-method
Lodash Object vs Array [immutable vs mutable] [object.keys vs object.entries]
Test native unique
lodash difference vs ES6 Set
Comments
Confirm delete:
Do you really want to delete benchmark?