Get

Benchmark created on


Preparation HTML

<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js"></script>

Setup

const test = { a: { b: { c: { d: 1 } } } };
const path = 'a.b.c.d';
const p = path.split('.');
const [a,b,c,d] = p;
const simple = 1;

Test runner

Ready to run.

Testing in
TestOps/sec
Basic
const v = test.a.b.c.d;
ready
Lodash
const v = _.get(test, path);
ready
Array Accessor
const v = test[p[0]][p[1]][p[2]][p[3]]
ready
Direct accessor
const v = test[a][b][c][d]
ready
Simple
const v = simple;
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.