Test name | Executions per second |
---|---|
Nullish coalescing (??) | 480776.7 Ops/sec |
Logical OR (||) | 468735.8 Ops/sec |
Nullish coalescing (??) [short-circuit] | 453323904.0 Ops/sec |
Logical OR (||) [short-circuit] | 452736928.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;