function optional chaining

Benchmark created on


Setup

class A {
	something(obj) { return JSON.stringify(obj) }
}

const a = new A();

Test runner

Ready to run.

Testing in
TestOps/sec
if scoped
if (a.something) {
	a.something({ date: Date.now() })
}
ready
optional chaining
a.something?.({ date: Date.now() });
ready
if scoped undefined
if (a.qwer) {
	a.qwer({ date: Date.now() })
}
ready
optional chaining undefined
a.qwer?.({ date: Date.now() });
ready

Revisions

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