Test name | Executions per second |
---|---|
Nullish coalescing (??) | 32094672.0 Ops/sec |
Logical OR (||) | 28184232.0 Ops/sec |
Nullish coalescing (??) [short-circuit] | 660594752.0 Ops/sec |
Logical OR (||) [short-circuit] | 686545792.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;