Run details:
Mozilla/5.0 (Linux; Android 9; Mi A1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.85 Mobile Safari/537.36
Chrome Mobile 94
Android
Mobile
3 years ago
Test name Executions per second
floor 382143.2 Ops/sec
~~ 699167.9 Ops/sec
>> 0 697498.1 Ops/sec
| 0 721249.4 Ops/sec
<< 0 717520.9 Ops/sec
& 0xFFFFFFFFFFFF 708575.8 Ops/sec
^ 0x000000000000 683161.1 Ops/sec
Math.trunc() 369384.0 Ops/sec
x - (x % 1) 425948.3 Ops/sec
parseInt() 391066.3 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()