Lodash get vs deconstruction
Date tested:
8 months ago
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Test name
Executions per second
lodash get
33100990.0 Ops/sec
deconstruct
32975520.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 req = { body: { test: 'testing' } }
Tests:
lodash get
const body = (req, ['body'], {})
deconstruct
const {body} = req
Open this result on MeasureThat.net