Run details:
Mozilla/5.0 (Linux; Android 7.1.1; MI MAX 2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Mobile Safari/537.36
Chrome Mobile 86
Android 7.1.1
Mobile
3 years ago
Test name Executions per second
floor 366997.1 Ops/sec
~~ 710893.2 Ops/sec
>> 0 740141.6 Ops/sec
| 0 697675.1 Ops/sec
<< 0 702250.8 Ops/sec
& 0xFFFFFFFFFFFF 706443.6 Ops/sec
^ 0x000000000000 738200.9 Ops/sec
Math.trunc() 365312.0 Ops/sec
x - (x % 1) 402434.0 Ops/sec
parseInt() 369120.3 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()