Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36
Chrome 104
Windows
Desktop
2 years ago
Test name Executions per second
floor 2697051.8 Ops/sec
~~ 5004864.5 Ops/sec
>> 0 5002481.5 Ops/sec
| 0 5006178.0 Ops/sec
<< 0 5006336.0 Ops/sec
& 0xFFFFFFFFFFFF 4985880.0 Ops/sec
^ 0x000000000000 5016582.5 Ops/sec
Math.trunc() 2715989.5 Ops/sec
x - (x % 1) 3419781.5 Ops/sec
parseInt() 2654553.8 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()