Test name | Executions per second |
---|---|
floor | 250709808.0 Ops/sec |
~~ | 251400432.0 Ops/sec |
>> 0 | 251846368.0 Ops/sec |
| 0 | 251362608.0 Ops/sec |
<< 0 | 251087216.0 Ops/sec |
& 0xFFFFFFFFFFFF | 250947728.0 Ops/sec |
^ 0x000000000000 | 251169632.0 Ops/sec |
Math.trunc() | 250608672.0 Ops/sec |
x - (x % 1) | 929202240.0 Ops/sec |
parseInt() | 251178560.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)