Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
bool to int
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:131.0) Gecko/20100101 Firefox/131.0
Browser:
Firefox 131
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
ternary
2321610496.0 Ops/sec
or operator
2330309376.0 Ops/sec
unary + operator
2335383552.0 Ops/sec
Number
51239064.0 Ops/sec
Script Preparation code:
const bool_t = true; const bool_f = false;
Tests:
ternary
true === true ? 1:0; false === true ? 1:0;
or operator
true | 0; false | 0;
unary + operator
+true +false
Number
Number(true); Number(false);