Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.88 Safari/537.36
Chrome 100
Windows
Desktop
2 years ago
Test name Executions per second
floor 2703159.5 Ops/sec
~~ 4899950.0 Ops/sec
>> 0 4806363.0 Ops/sec
| 0 4614734.5 Ops/sec
<< 0 4802853.5 Ops/sec
& 0xFFFFFFFFFFFF 4738845.5 Ops/sec
^ 0x000000000000 4766234.0 Ops/sec
Math.trunc() 2622717.2 Ops/sec
x - (x % 1) 3118408.8 Ops/sec
parseInt() 2560641.2 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()