Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Ternary with null choice vs &&
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Browser:
Chrome 132
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
&& with false condition
23.1M/s
Ternary with false condition
23.1M/s
&& with true condition
23.0M/s
Ternary with true condition
22.9M/s
View exact numbers
Test name
Executions per second
✓
&& with false condition
23,103,980 Ops/sec
Ternary with false condition
23,060,302 Ops/sec
&& with true condition
23,032,526 Ops/sec
Ternary with true condition
22,910,836 Ops/sec
Script Preparation code:
const foo = "a choice" let result = ""
Tests:
Ternary with true condition
result = true ? foo : null
Ternary with false condition
result = false ? foo : null
&& with true condition
result = true && foo
&& with false condition
result = false && foo