Last active
October 28, 2017 18:41
-
-
Save acao/d9f0e78d6efc337f4c116972bdd55d82 to your computer and use it in GitHub Desktop.
Get/Set Benchmark Step 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script> | |
| var suite = new Benchmark.Suite(); | |
| const obj = { | |
| stuff: { | |
| things: { | |
| stuff: 'things', | |
| things: 'stuff', | |
| other: { | |
| stuff: 'things' | |
| } | |
| } | |
| } | |
| }; | |
| const path = 'stuff.things.other.stuff'; | |
| const valToSet = 9999; | |
| suite | |
| .add('lodash get', () => { | |
| _.get(obj, path); | |
| }) | |
| .on('cycle', event => { | |
| console.log(String(event.target.fn)); | |
| console.log(String(event.target)); | |
| }) | |
| .on('complete', () => { | |
| console.log('Fastest is ' + this.filter('fastest').map('name')); | |
| }) | |
| .run(); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment