Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36
Chrome 101
Windows
Desktop
2 years ago
Test name Executions per second
floor 1573855.9 Ops/sec
~~ 3404345.0 Ops/sec
>> 0 3549868.0 Ops/sec
| 0 3565314.5 Ops/sec
<< 0 3422353.0 Ops/sec
& 0xFFFFFFFFFFFF 3539735.2 Ops/sec
^ 0x000000000000 3412729.2 Ops/sec
Math.trunc() 1803134.8 Ops/sec
x - (x % 1) 2446572.5 Ops/sec
parseInt() 1840853.2 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()