Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0
Firefox 68
Linux
Desktop
2 years ago
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
Tests:
  • Nullish coalescing (??)

    AخA
     
    let x = null ?? undefined ?? null ?? undefined ?? null ?? undefined ?? null ?? undefined ?? null ?? undefined ?? 1;
  • Logical OR (||)

     
    let x = null || undefined || null || undefined || null || undefined || null || undefined || null || undefined || 1;
  • Nullish coalescing (??) [short-circuit]

     
    let x = 1 ?? undefined ?? null ?? undefined ?? null ?? undefined ?? null ?? undefined ?? null ?? undefined ?? 1;
  • Logical OR (||) [short-circuit]

     
    let x = 1 || undefined || null || undefined || null || undefined || null || undefined || null || undefined || 1;