Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Lodash.get vs object-path vs Property dot notation (optional chaining)
Modified from https://gist.github.com/acao/018fa0943da0e39c96f57fca64cd0c02
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Browser:
Chrome 120
Operating system:
Linux
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
Lodash get
396797.1 Ops/sec
object path
232707.8 Ops/sec
Native
3039312.5 Ops/sec
HTML Preparation code:
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js" type="text/javascript"></script> <script src="https://cdn.rawgit.com/mariocasciaro/object-path/master/index.js"></script>
Script Preparation code:
var obj = { stuff: { things: { stuff: 'things', things: 'stuff', other: { stuff: 'things' } } } };
Tests:
Lodash get
_.get(obj, 'stuff.things.other.stuff');
object path
objectPath.get(obj, 'stuff.things.other.stuff');
Native
obj?.stuff?.things?.other?.stuff;