Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Lodash.get vs safeGet vs Native
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:136.0) Gecko/20100101 Firefox/136.0
Browser:
Firefox 136
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Lodash get
2432584.8 Ops/sec
safeGet
3013261.0 Ops/sec
Native
680453248.0 Ops/sec
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/lodash/4.16.0/lodash.min.js"></script>
Script Preparation code:
var person = {name: 'Frederick', lastName: 'Corcino Alejo', nested: {name: 'test'}}; function safeGet(obj, path, defaultValue) { return path.split('.').reduce((xs, x) => (xs && xs[x]) ? xs[x] : defaultValue, obj); }
Tests:
Lodash get
_.get(person, 'name', ''); _.get(person, 'nested.name', '');
safeGet
safeGet(person, 'name', ''); safeGet(person, 'nested.name', '');
Native
person.name; person.nested.name;