Number() vs parseInt() vs plus vs bitwise (v87)

Revision 87 of this benchmark created on


Setup

var x = "102961127921";

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);
ready
Math.floor
Math.floor(x);
ready

Revisions

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