Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36
Chrome 94
Windows
Desktop
3 years ago
Test name Executions per second
floor 2016033.0 Ops/sec
~~ 3747719.5 Ops/sec
>> 0 3802494.2 Ops/sec
| 0 3791359.5 Ops/sec
<< 0 3777456.5 Ops/sec
& 0xFFFFFFFFFFFF 3707995.8 Ops/sec
^ 0x000000000000 3700042.5 Ops/sec
Math.trunc() 2048587.5 Ops/sec
x - (x % 1) 2386063.2 Ops/sec
parseInt() 1962913.9 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()