in-scope objects vs out-of-scope objects

Benchmark created by Sander Ronde on


Test runner

Ready to run.

Testing in
TestOps/sec
in-scope object
function getObj() {
    return {
        a: 'b',
        b: 'c',
        c: 'd',
        d: 'e',
        e: 'f'
    }
}
getObj()[getObj()[getObj()[getObj()[getObj()['a']]]]]
ready
out-of-scope object
const obj = {
        a: 'b',
        b: 'c',
        c: 'd',
        d: 'e',
        e: 'f'
    };
function getObj() {
    return obj;
}
getObj()[getObj()[getObj()[getObj()[getObj()['a']]]]]
ready

Revisions

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

  • Revision 1: published by Sander Ronde on