Run details:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36
Chrome 124
Mac OS X 10.15.7
Desktop
2 years ago
Benchmark.js
destructuring with defaults, empty input
5.9M/s
destructuring with defaults, find item
2.3M/s
destructuring dynamic key
2.2M/s
lodash get, empty input
1.7M/s
lodash dynamic key using array
1.4M/s
lodash dynamic key using manually cached array
1.4M/s
lodash get, find item
1.1M/s
lodash dynamic key
847K/s
View exact numbers
Test name Executions per second
destructuring with defaults, empty input 5,880,484 Ops/sec
destructuring with defaults, find item 2,252,436 Ops/sec
destructuring dynamic key 2,190,208 Ops/sec
lodash get, empty input 1,702,740 Ops/sec
lodash dynamic key using array 1,364,767 Ops/sec
lodash dynamic key using manually cached array 1,358,366 Ops/sec
lodash get, find item 1,083,742 Ops/sec
lodash dynamic key 847,154 Ops/sec
HTML Preparation code:
Script Preparation code:
Tests: