HTML Preparation code:
AخA
 
1
<script src="https://cdn.jsdelivr.net/lodash/4.16.0/lodash.min.js"></script>
Script Preparation code:
 
var person = {data: {type: 'Frederick'}};
Tests:
  • Lodash get string

     
    _.get(person, 'data.type');
  • Lodash get array

     
    const type = _.get(person, ['data', 'type']);
  • Native

     
    const type = person.data.type
  • Native with checking for missing object

     
    const data = person.data
    if(data !== null){
      const type = data.type
    }
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Lodash get string
    Lodash get array
    Native
    Native with checking for missing object

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36
Chrome 97 on Mac OS X 10.15.7
View result in a separate tab
Test name Executions per second
Lodash get string 2976911.2 Ops/sec
Lodash get array 4487002.0 Ops/sec
Native 17036738.0 Ops/sec
Native with checking for missing object 17072112.0 Ops/sec