Conversion from boolean to number (v8)

Revision 8 of this benchmark created by Matt on


Setup

var boolValue = true;

Test runner

Ready to run.

Testing in
TestOps/sec
Ternary operator
boolValue ? 1 : 0
ready
Unary + operator
+boolValue
ready
Number function
Number(boolValue)
ready
Unary & operator
boolValue & 1
ready
line
boolValue | 0
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.