Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Object.keys vs lodash _.forEach
(version: 0)
Also checking the .map method on the returned array.
Comparing performance of:
_.forEach vs native with map vs native with forEach
Created:
4 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/lodash/4.16.0/lodash.min.js"></script>
Script Preparation code:
var value = {a: 30310, b: '100303', c: '3040494'}
Tests:
_.forEach
_.forEach(value,function(value,key){ return {value: _.camelCase(key), label: _.startCase(key)}} )
native with map
Object.keys(value).map( function(key){ return {value: _.camelCase(key), label: _.startCase(key)}} )
native with forEach
var arr = [] Object.keys(value).forEach( function(key){ return arr.push({value: _.camelCase(key), label: _.startCase(key)}) } )
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
_.forEach
native with map
native with forEach
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:
lodash.keys vs Object.keys
lodash.keys vs Object.keys
lodash.keys vs Object.keys
lodash.each vs Object.forEach
lodash (v4.17.15) map vs Object.keys map
Comments
Confirm delete:
Do you really want to delete benchmark?