Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36
Chrome 91
Windows
Desktop
3 years ago
Test name Executions per second
floor 2795838.0 Ops/sec
~~ 5185465.0 Ops/sec
>> 0 5208562.5 Ops/sec
| 0 5216646.5 Ops/sec
<< 0 5225069.0 Ops/sec
& 0xFFFFFFFFFFFF 5281291.5 Ops/sec
^ 0x000000000000 5213105.5 Ops/sec
Math.trunc() 2804386.8 Ops/sec
x - (x % 1) 3481690.2 Ops/sec
parseInt() 2748221.5 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()