Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36
Chrome 102
Linux
Desktop
2 years ago
Test name Executions per second
floor 2823634.2 Ops/sec
~~ 5572294.5 Ops/sec
>> 0 5684325.0 Ops/sec
| 0 5664982.0 Ops/sec
<< 0 5618506.0 Ops/sec
& 0xFFFFFFFFFFFF 4929835.0 Ops/sec
^ 0x000000000000 5294699.5 Ops/sec
Math.trunc() 2721587.5 Ops/sec
x - (x % 1) 3757229.2 Ops/sec
parseInt() 2625856.5 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()