Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36
Chrome 94
Windows
Desktop
3 years ago
Test name Executions per second
floor 2689160.5 Ops/sec
~~ 4746260.0 Ops/sec
>> 0 4538321.0 Ops/sec
| 0 4220982.0 Ops/sec
<< 0 4609547.5 Ops/sec
& 0xFFFFFFFFFFFF 4226948.5 Ops/sec
^ 0x000000000000 4328301.0 Ops/sec
Math.trunc() 2431237.2 Ops/sec
x - (x % 1) 3083115.8 Ops/sec
parseInt() 2611918.5 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()