Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.147 Safari/537.36
Chrome 100
Windows
Desktop
2 years ago
Test name Executions per second
floor 977839.2 Ops/sec
~~ 1795755.1 Ops/sec
>> 0 1879026.9 Ops/sec
| 0 1811728.1 Ops/sec
<< 0 1832570.1 Ops/sec
& 0xFFFFFFFFFFFF 1799048.1 Ops/sec
^ 0x000000000000 1779643.1 Ops/sec
Math.trunc() 1024778.5 Ops/sec
x - (x % 1) 1301096.2 Ops/sec
parseInt() 966145.3 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()