Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36
Chrome 90
Windows
Desktop
3 years ago
Test name Executions per second
floor 2083107.0 Ops/sec
~~ 3801705.8 Ops/sec
>> 0 4189732.8 Ops/sec
| 0 4181918.8 Ops/sec
<< 0 3421938.0 Ops/sec
& 0xFFFFFFFFFFFF 3989027.2 Ops/sec
^ 0x000000000000 4189441.8 Ops/sec
Math.trunc() 2302701.2 Ops/sec
x - (x % 1) 2779090.0 Ops/sec
parseInt() 2227745.2 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()