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 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0
Browser:
Firefox 128
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
ternary
1108.7M/s
unary + operator
1065.2M/s
or operator
1032.7M/s
Number
13.5M/s
View exact numbers
Test name
Executions per second
✓
ternary
1,108,658,304 Ops/sec
unary + operator
1,065,155,904 Ops/sec
or operator
1,032,713,792 Ops/sec
Number
13,453,378 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);