HTML Preparation code:
x
 
1
2
<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 with lodash

     
    _.get(obj, 'test', false) || new Set();
    _.get(obj, 'missing', false) || new Set();
  • Boolean logic only

     
    !!obj.test || new Set();
    !!obj.missing || new Set();
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    With new instance in get default
    Boolean logic with lodash
    Boolean logic only

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 5 years ago)
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
Chrome 78 on Mac OS X 10.14.6
View result in a separate tab
Test name Executions per second
With new instance in get default 1203198.6 Ops/sec
Boolean logic with lodash 1439550.2 Ops/sec
Boolean logic only 4052933.0 Ops/sec