Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.112 Safari/537.36
Chrome 86
Windows
Desktop
4 years ago
Test name Executions per second
floor 2417298.2 Ops/sec
~~ 4054889.2 Ops/sec
>> 0 4058508.8 Ops/sec
| 0 4158778.2 Ops/sec
<< 0 4098704.5 Ops/sec
& 0xFFFFFFFFFFFF 4171374.2 Ops/sec
^ 0x000000000000 4162018.0 Ops/sec
Math.trunc() 2379847.8 Ops/sec
x - (x % 1) 2873240.8 Ops/sec
parseInt() 2331631.5 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()