Number vs. plus vs. parseInt vs. parseFloat vs. /1 vs. *1 vs. 0+ vs. 1* (v22)

Revision 22 of this benchmark created on


Preparation HTML

<script>
  "use asm";
  var num1 = '1234567890';
  var num2 = '3.14159265359';
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Number
Number(num1);
Number(num2)
ready
parseInt
parseInt(num1, 10);
parseInt(num2, 10);
ready
parseFloat
parseFloat(num1);
parseFloat(num2);
ready
parseInt (no extra parameter)
parseInt(num1);
parseInt(num2);
ready
divide by 1
num1 / 1;
num2 / 1;
ready
multiply by 1
num1 * 1;
num2 * 1;
ready
1*
1 * num1;
1 * num1;
ready
-0
num1 - 0
num2 - 0
ready
Bitwise not (~~1)
~~num1
~~num2
ready

Revisions

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