Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36
Chrome 91
Windows
Desktop
3 years ago
Test name Executions per second
floor 2295775.2 Ops/sec
~~ 4412728.5 Ops/sec
>> 0 4262188.5 Ops/sec
| 0 4376957.5 Ops/sec
<< 0 4443708.5 Ops/sec
& 0xFFFFFFFFFFFF 4435351.0 Ops/sec
^ 0x000000000000 4167842.5 Ops/sec
Math.trunc() 2315307.2 Ops/sec
x - (x % 1) 2491962.8 Ops/sec
parseInt() 2109558.8 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()