Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
Chrome 108
Linux
Desktop
one year ago
Test name Executions per second
floor 2382149.8 Ops/sec
~~ 4294300.0 Ops/sec
>> 0 4267139.5 Ops/sec
| 0 4247741.5 Ops/sec
<< 0 4254870.5 Ops/sec
& 0xFFFFFFFFFFFF 4303993.5 Ops/sec
^ 0x000000000000 4354784.5 Ops/sec
Math.trunc() 2383956.0 Ops/sec
x - (x % 1) 2936106.2 Ops/sec
parseInt() 2284511.5 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()