Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Lodash pick vs Object.entries
(version: 4)
Comparing performance of:
Lodash vs Native 1 vs ES Toolkit vs Native 2
Created:
4 months ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/es-toolkit@%5E1"></script> <script> window.estoolkit = window._; </script> <script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min.js'></script> <script> window.lodash = window._; </script> <script src='https://cdnjs.cloudflare.com/ajax/libs/radash/12.1.1/radash.min.js'></script> <script> window.radash = window._; </script>
Script Preparation code:
const props = { a: 1, b: { c: "foo", d: "bar", }, e: 3, f: 7, g: "test", h: { i: { j: 123, }, }, } const keys = ['a', 'e', 'f', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v']
Tests:
Lodash
const spacing = lodash.pick(props, keys)
Native 1
const entries = Object.entries(props) const spacingEntries = entries.filter(([key]) => keys.includes(key)) const spacing = Object.fromEntries(spacingEntries)
ES Toolkit
const spacing = estoolkit.pick(props, keys)
Native 2
const spacing = keys.reduce((obj, key) => { if (props && props.hasOwnProperty(key)) { obj[key] = props[key]; } return obj; }, {});
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
Lodash
Native 1
ES Toolkit
Native 2
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
4 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0
Browser/OS:
Chrome 143 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Lodash
394717.4 Ops/sec
Native 1
1332686.9 Ops/sec
ES Toolkit
630382.8 Ops/sec
Native 2
3253898.2 Ops/sec
Related benchmarks:
_.some vs deconstruction
lookup table vs switch
lodash uniq vs set dsfasfasfadsfasdfasd
Obj iteration v2
Compare lodash.get with native code
switch vs if else
object destructuring
lodash isEmpty vs native Object.keys
switch vs if else improved
Comments
Confirm delete:
Do you really want to delete benchmark?