Test name | Executions per second |
---|---|
floor | 694632448.0 Ops/sec |
~~ | 760053056.0 Ops/sec |
>> 0 | 722013120.0 Ops/sec |
| 0 | 761743744.0 Ops/sec |
<< 0 | 753895744.0 Ops/sec |
& 0xFFFFFFFFFFFF | 734273536.0 Ops/sec |
^ 0x000000000000 | 753432960.0 Ops/sec |
Math.trunc() | 681801024.0 Ops/sec |
x - (x % 1) | 941477184.0 Ops/sec |
parseInt() | 28658106.0 Ops/sec |
var x = Math.random() * 100000000;
var y;
y = Math.floor(x);
y = ~~x;
y = x >> 0;
y = x | 0;
y = x << 0;
y = x & 0xFFFFFFFFFFFF;
y = x ^ 0x000000000000;
y = Math.trunc(x);
y = x - (x % 1);
y = parseInt(x)