Destructuring with null coalesce versus optional chaining with short circuit or

Benchmark created on


Setup

o = {}

Test runner

Ready to run.

Testing in
TestOps/sec
Destructuring with null coalesce
const { r = 0 } = o['n'] ?? {}
ready
Optional chaining with short circuit or
const r = o['n']?.r || 0
ready

Revisions

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