Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36
Chrome 101
Linux
Desktop
one year ago
Test name Executions per second
floor 2607197.0 Ops/sec
~~ 5091038.0 Ops/sec
>> 0 5131205.5 Ops/sec
| 0 5137895.0 Ops/sec
<< 0 5167879.5 Ops/sec
& 0xFFFFFFFFFFFF 5224357.5 Ops/sec
^ 0x000000000000 5283062.5 Ops/sec
Math.trunc() 2714913.0 Ops/sec
x - (x % 1) 3607048.0 Ops/sec
parseInt() 2766125.2 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()