Float to Int conversion comparison (v19)

Revision 19 of this benchmark created on


Setup

var number = Math.random() * 1024,
        floor = Math.floor;

Test runner

Ready to run.

Testing in
TestOps/sec
Bitwise OR
number | 0;
ready
Bitwise NOT
~~number
ready
Math.floor
floor(number)
ready
parseInt
parseInt(number, 10)
ready
shift
number >> 0
ready
shift more
number >>> 0
ready
modulo
number - number % 1
ready

Revisions

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