Math.floor vs Math.round vs parseInt vs Bitwise (v39)

Revision 39 of this benchmark created on


Description

Rounding in all form possible

Test runner

Ready to run.

Testing in
TestOps/sec
Math.floor
Math.floor(Math.random());
ready
Math.round
Math.round(Math.random());
ready
parseInt
parseInt(Math.random());
ready
Bitwise |
Math.random() | 0;
ready
Bitwise
Math.random() >> 0;
ready
Bit flipping
~~(Math.random());
ready

Revisions

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