Lodash.get with instance default
Date tested:
4 years ago
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36
Test name
Executions per second
With new instance in get default
1241767.0 Ops/sec
Boolean logic
1455472.0 Ops/sec
Benchmark definition (click to collapse):
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 = { test: 123 }
Tests:
With new instance in get default
_.get(obj, 'test', new Set()); _.get(obj, 'missing', new Set());
Boolean logic
_.get(obj, 'test', false) || new Set(); _.get(obj, 'missing', false) || new Set();
Open this result on MeasureThat.net