Float to Int conversion comparison

JavaScript performance comparison

Revision 17 of this test case created by Favian

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  var randNum = Math.random() * 1000;

};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
Bitwise OR
randNum | 0;
pending…
Bitwise NOT
~~randNum;
pending…
Math.floor
Math.floor(randNum);
pending…
parseInt
parseInt(randNum, 10);
pending…
Left Shift
randNum << 0;
pending…
Bitwise XOR
randNum ^ 0;
pending…
Math.round
Math.round(randNum);
pending…
>>
randNum >> 0;
pending…
>>>
randNum >>> 0;
pending…

Compare results of other browsers

Revisions

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

0 Comments