Run details:
Mozilla/5.0 (Linux; Android 11; Pixel 3 XL Build/RQ1A.201205.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/87.0.4280.101 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/300.1.0.57.129;]
Chrome Mobile 87
Android
Mobile
3 years ago
Test name Executions per second
floor 1517522.5 Ops/sec
~~ 3077471.2 Ops/sec
>> 0 3118172.8 Ops/sec
| 0 3103302.5 Ops/sec
<< 0 3080258.8 Ops/sec
& 0xFFFFFFFFFFFF 3066366.2 Ops/sec
^ 0x000000000000 3072188.2 Ops/sec
Math.trunc() 1548214.8 Ops/sec
x - (x % 1) 1782236.0 Ops/sec
parseInt() 1610854.4 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()