Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Nullish coalescing (??) vs logical OR (||)
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:125.0) Gecko/20100101 Firefox/125.0
Browser:
Firefox 125
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
2 years ago
Nullish coalescing (??) [short-circuit]
1587.3M/s
Logical OR (||) [short-circuit]
1586.7M/s
Logical OR (||)
1584.8M/s
Nullish coalescing (??)
906.8M/s
View exact numbers
Test name
Executions per second
✓
Nullish coalescing (??) [short-circuit]
1,587,259,648 Ops/sec
Logical OR (||) [short-circuit]
1,586,711,680 Ops/sec
Logical OR (||)
1,584,768,128 Ops/sec
Nullish coalescing (??)
906,812,224 Ops/sec
Tests:
Nullish coalescing (??)
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;