Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0
Chrome 124
Windows
Desktop
2 years ago
Benchmark.js
destructuring with defaults, empty input
8.6M/s
destructuring dynamic key
3.5M/s
destructuring with defaults, find item
3.3M/s
lodash get, empty input
2.7M/s
lodash dynamic key using array
2.2M/s
lodash dynamic key using manually cached array
2.2M/s
lodash get, find item
1.7M/s
lodash dynamic key
1.4M/s
View exact numbers
Test name Executions per second
destructuring with defaults, empty input 8,553,576 Ops/sec
destructuring dynamic key 3,471,497 Ops/sec
destructuring with defaults, find item 3,320,352 Ops/sec
lodash get, empty input 2,700,587 Ops/sec
lodash dynamic key using array 2,190,690 Ops/sec
lodash dynamic key using manually cached array 2,151,690 Ops/sec
lodash get, find item 1,715,988 Ops/sec
lodash dynamic key 1,378,732 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests: