Test name | Executions per second |
---|---|
floor | 3285475.0 Ops/sec |
~~ | 6032852.0 Ops/sec |
>> 0 | 6032436.0 Ops/sec |
| 0 | 6047907.0 Ops/sec |
<< 0 | 6032501.5 Ops/sec |
& 0xFFFFFFFFFFFF | 6039361.5 Ops/sec |
^ 0x000000000000 | 6030092.5 Ops/sec |
Math.trunc() | 3283493.5 Ops/sec |
x - (x % 1) | 4162351.8 Ops/sec |
parseInt() | 3313339.5 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)