Run details:
Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36
Chrome 91
Windows 8.1
Desktop
3 years ago
Test name Executions per second
floor 661760.2 Ops/sec
~~ 1437779.9 Ops/sec
>> 0 1430730.8 Ops/sec
| 0 1357938.5 Ops/sec
<< 0 1362468.5 Ops/sec
& 0xFFFFFFFFFFFF 1408661.9 Ops/sec
^ 0x000000000000 1381164.6 Ops/sec
Math.trunc() 731980.2 Ops/sec
x - (x % 1) 909412.7 Ops/sec
parseInt() 752243.2 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()