Number() vs parseInt() vs plus vs bitwise (float) (v80)

Revision 80 of this benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
Number Constructor
Number("13268.94939");
ready
parseInt
parseInt("13268.94939");
ready
Plus operator
+"13268.94939";
ready
Bitwise >> (right shift)
"13268.94939" >> 0;
ready
Multiply (force cast)
"13268.94939" * 1;
ready
Bitwise NOT
~~"13268.94939";
ready
parseInt with base argument
parseInt("13268.94939", 10);
ready
Bitwise OR
"13268.94939" | 0
ready
minus 0
"13268.94939" - 0;
ready
Bitwise NOT (already number)
~~13268.94939;
ready
Control group
; // nothing
ready
Bitwise NOT (float)
//var arr = "13268.94939".split(".");
//~~arr[0] + (arr.length > 1 ? "." + ~~arr[1] : "");
 
ready

Revisions

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