Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
Chrome 109
Linux
Desktop
one year ago
Test name Executions per second
floor 5968519.5 Ops/sec
~~ 11430033.0 Ops/sec
>> 0 11295002.0 Ops/sec
| 0 11309451.0 Ops/sec
<< 0 11273978.0 Ops/sec
& 0xFFFFFFFFFFFF 11155053.0 Ops/sec
^ 0x000000000000 10993247.0 Ops/sec
Math.trunc() 5703460.5 Ops/sec
x - (x % 1) 7191102.0 Ops/sec
parseInt() 5595991.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()