Number() vs parseInt() vs plus vs bitwise (v17)

Revision 17 of this benchmark created on


Setup

s = "10";
  v = 123;

Test runner

Ready to run.

Testing in
TestOps/sec
Number Constructor
v = Number(s);
ready
parseInt
v = parseInt(s);
ready
Plus operator
v = +s;
ready
Bitwise >> (right shift)
v = s >> 0;
ready
Multiply (force cast)
v = s * 1;
ready
not not
v = ~~s;
ready
"10"<<0
v = s<<0;
ready
"10"<<<0
v = s>>>0
ready
parseInt("10", 10)
v = parseInt(s, 10);
ready
Bitwise or
v = s | 0;
ready

Revisions

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