Number() vs parseInt() vs plus vs bitwise (v67)

Revision 67 of this benchmark created by Adam Stankiewicz on


Setup

var number = Math.floor((Math.random() * 100000000) + 1);

Test runner

Ready to run.

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

Revisions

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