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

Revision 24 of this benchmark created on


Preparation HTML

<script>
  var num = '12100';
var num2 = '3000'
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
Number
Number(num);
ready
+
+num;
ready
parseInt
parseInt(num, 10);
ready
parseFloat
parseFloat(num);
ready
parseInt (no extra parameter)
parseInt(num);
ready
divide by 1
num / 1;
ready
multiply by 1
num * 1;
ready
0+
0 + num;
ready
1*
1 * num;
ready
Compare ParseInt only 1st
parseInt(num, 10) > num2
ready
ParseInt both
parseInt(num, 10) > parseInt(num2,10)
ready

Revisions

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