Test name | Executions per second |
---|---|
Nullish coalescing (??) | 1938339.4 Ops/sec |
Logical OR (||) | 1931380.5 Ops/sec |
Nullish coalescing (??) [short-circuit] | 998490688.0 Ops/sec |
Logical OR (||) [short-circuit] | 1003694528.0 Ops/sec |
let x = null ?? undefined ?? null ?? undefined ?? null ?? undefined ?? null ?? undefined ?? null ?? undefined ?? 1;
let x = null || undefined || null || undefined || null || undefined || null || undefined || null || undefined || 1;
let x = 1 ?? undefined ?? null ?? undefined ?? null ?? undefined ?? null ?? undefined ?? null ?? undefined ?? 1;
let x = 1 || undefined || null || undefined || null || undefined || null || undefined || null || undefined || 1;