Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
object to array with lodash
(version: 0)
Comparing performance of:
Array.prototype.reduce() vs _.reduce() vs _.values() vs _.toArray()
Created:
8 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.5/lodash.min.js"></script>
Script Preparation code:
var object = { 'a': { 'key': 'a', 'foo': 123123, 'bar': 123, 'fobar': 456 }, 'b': { 'key': 'b', 'foo': 67563, 'bar': 6345, 'fobar': 3425 }, 'c': { 'key': 'c', 'foo': 34532, 'bar': 123412, 'fobar': 534532 }, 'd': { 'key': 'd', 'foo': 1234321, 'bar': 435234, 'fobar': 346457 }, 'e': { 'key': 'e', 'foo': 23523, 'bar': 124325, 'fobar': 2134235 }, 'f': { 'key': 'f', 'foo': 1235213, 'bar': 346346, 'fobar': 213423 } };
Tests:
Array.prototype.reduce()
Object.keys(object).reduce(function(acc, cur) { acc.push(object[cur]); return acc; }, []);
_.reduce()
_.reduce(object, function(acc, cur) { acc.push(cur); return acc; }, []);
_.values()
_.values(object);
_.toArray()
_.toArray(object);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
Array.prototype.reduce()
_.reduce()
_.values()
_.toArray()
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:
array to object by key with lodash
merge object by key from array with lodash
merge object by key from array with lodash
merge object by key from array with lodash
Comments
Confirm delete:
Do you really want to delete benchmark?