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

Revision 98 of this benchmark created on


Description

Rounding in all form possible

Setup

var num = Math.random() * 255 * 255

Test runner

Ready to run.

Testing in
TestOps/sec
Math.floor
Math.floor(num);
ready
Math.round
Math.round(num);
ready
double ~
~~num;
ready
Bitwise |
num | 0;
ready
Bitwise
num >> 1;
ready

Revisions

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