Optional Chaining

Benchmark created on


Description

Does optional chaining introduce a significant slowdown?

Setup

const data = { key: "value" }

Test runner

Ready to run.

Testing in
TestOps/sec
Checking presence before access
if (data.key) {
	data.key.length;
}
if (data.missing) {
	data.missing.length;
}
ready
Optional chaining
data.key?.length;
data.missing?.length;
ready

Revisions

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