Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Lodash forOwn vs Native keys + forEach 2
(version: 0)
Comparing performance of:
lodash forOwn vs Keys and then forEach vs for key vs for key value
Created:
5 years 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 obj = { a: 1, b: 2, c: 3, }
Tests:
lodash forOwn
_.forOwn(obj, (a) => {console.log(a)});
Keys and then forEach
Object.keys(obj).forEach((a) => {console.log(a)});
for key
for (let key in obj) { // check if the property/key is defined in the object itself, not in parent if (obj.hasOwnProperty(key)) { console.log(key, obj[key]); } }
for key value
for (const [key, value] of Object.entries(obj)) { console.log(key, value); }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
lodash forOwn
Keys and then forEach
for key
for key value
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 forOwn vs Native keys + forEach
Lodash forOwn vs native Object.values and forEach
Lodash Object Iteration vs Native
Lodash forOwn vs Native keys + forEach 1000 keys
Comments
Confirm delete:
Do you really want to delete benchmark?