Number() vs parseInt() vs plus vs bitwise (v37)

Revision 37 of this benchmark created on


Setup

var x = '13.6.1.94';

Test runner

Ready to run.

Testing in
TestOps/sec
Number Constructor
Number(x);
ready
parseInt
parseInt(x);
ready
Plus operator
+x;
ready
Bitwise >> (right shift)
x >> 0;
ready
Multiply (force cast)
x * 1;
ready
Bitwise NOT
~~x;
ready
parseInt with base argument
parseInt(x, 10);
ready
Bitwise OR
x | 0
ready
minus 0
x - 0;
ready
JSON.parse()
JSON.parse(x)
ready
parseFloat
parseFloat(x, 10)
ready
Math.floor
Math.floor(x, 10)
ready

Revisions

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