Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36
Chrome 91
Linux
Desktop
3 years ago
Test name Executions per second
floor 4204232.5 Ops/sec
~~ 7328803.5 Ops/sec
>> 0 7227842.0 Ops/sec
| 0 7292438.0 Ops/sec
<< 0 7390940.5 Ops/sec
& 0xFFFFFFFFFFFF 7379656.5 Ops/sec
^ 0x000000000000 7881011.5 Ops/sec
Math.trunc() 4235084.5 Ops/sec
x - (x % 1) 4995618.0 Ops/sec
parseInt() 4091622.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()