Float to Int conversion comparison (v17)

Revision 17 of this benchmark created by Favian on


Setup

var randNum = Math.random() * 1000;

Test runner

Ready to run.

Testing in
TestOps/sec
Bitwise OR
randNum | 0;
ready
Bitwise NOT
~~randNum;
ready
Math.floor
Math.floor(randNum);
ready
parseInt
parseInt(randNum, 10);
ready
Left Shift
randNum << 0;
ready
Bitwise XOR
randNum ^ 0;
ready
Math.round
Math.round(randNum);
ready
>>
randNum >> 0;
ready
>>>
randNum >>> 0;
ready

Revisions

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