Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5083.0 Safari/537.36
Chrome 104
Windows
Desktop
2 years ago
Test name Executions per second
floor 904598.8 Ops/sec
~~ 1658717.1 Ops/sec
>> 0 1476527.6 Ops/sec
| 0 1379473.1 Ops/sec
<< 0 1485872.4 Ops/sec
& 0xFFFFFFFFFFFF 1098229.1 Ops/sec
^ 0x000000000000 660028.1 Ops/sec
Math.trunc() 452088.6 Ops/sec
x - (x % 1) 809637.7 Ops/sec
parseInt() 568907.2 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()


;