best of string to number conversion (v37)

Revision 37 of this benchmark created by ostin on


Setup

var a = 'a';
    var b = 1;
    var c = '1';

Test runner

Ready to run.

Testing in
TestOps/sec
Number()
Number(a);
Number(b);
Number(c);
ready
parseInt()
parseInt(a, 10);
parseInt(b, 10);
parseInt(c, 10);
ready
parseFloat()
parseFloat(a);
parseFloat(b);
parseFloat(c);
ready
implicit
+a;
+b;
+c;
ready
Left Bit Shift
a << 0;
b << 0;
c << 0;
ready
Right Bit Shift
a >> 0;
b >> 0;
c >> 0;
ready
Unsigned Bit Shift
a >>> 0;
b >>> 0;
c >>> 0;
ready
Bitwise OR
a | 0;
b | 0;
c | 0;
ready
Bitwise XOR
a ^ 0;
b ^ 0;
c ^ 0;
ready
Subtract Zero
a - 0;
b - 0;
c - 0;
ready
Divide By 1
a / 1;
b / 1;
c / 1;
ready
Multiply By 1
a * 1;
b * 1;
c * 1;
ready
Double Tilde
~~a;
~~b;
~~c;
ready

Revisions

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