Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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
Benchmark engine:
Benchmark.js
unary + operator
2335.4M/s
or operator
2330.3M/s
ternary
2321.6M/s
Number
51.2M/s
View exact numbers
Test name
Executions per second
✓
unary + operator
2,335,383,552 Ops/sec
or operator
2,330,309,376 Ops/sec
ternary
2,321,610,496 Ops/sec
Number
51,239,064 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);