typescript-es5-vs-es2022-nullish-coalescing

Benchmark created on


Setup

const d1 = {
    summary: {
        total_actions: 4,
        finished_actions: 4,
    },
    updated_at: '2020-07-15T10:24:42.364000000Z',
    job_id: '4b1733e7-c8e0-4fdd-a7f1-13d3ab725c92',
    description: 'Job from our export',
    created_at: '2020-07-15T10:24:40.975000000Z',
    status: 'finished',
    tags: {
        export_id: ['8848c5d8-fd44-43c0-b7f2-1428d0f4891a'],
        anotherObj: {
            anotherObj: {
                anotherObj: {
                    somekey: 1,
                },
            },
        },
    },
};

Test runner

Ready to run.

Testing in
TestOps/sec
es5
var _a, _b, _c, _d;
if (((_d = (_c = (_b = (_a = d1.tags) === null || _a === void 0 ? void 0 : _a.anotherObj) === null || _b === void 0 ? void 0 : _b.anotherObj) === null || _c === void 0 ? void 0 : _c.anotherObj) === null || _d === void 0 ? void 0 : _d.somekey) == 1) {
}
ready
es2022
if (d1.tags?.anotherObj?.anotherObj?.anotherObj?.somekey == 1) {
}
ready

Revisions

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