parsing 2 integer

Benchmark created by Rimantas on


Preparation HTML

<div id="div" style="width:200px;">test div</div>
<script>
  var width = document.getElementById('div').style.width.replace(/px|pt/);
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
parseInt()
width = parseInt(width);
ready
byte moving
width = (width >> 0);
ready
simple substraction
width -= 0;
ready
simple multiplication
width *= 1;
ready
uniry +
width = +width;
ready
Number()
width = Number(width);
ready

Revisions

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

  • Revision 1: published by Rimantas on