Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 YaBrowser/23.1.1.1138 Yowser/2.5 Safari/537.36
Yandex Browser 23
Windows
Desktop
one year ago
Test name Executions per second
floor 2844246.8 Ops/sec
~~ 5650794.0 Ops/sec
>> 0 5882594.5 Ops/sec
| 0 5753681.0 Ops/sec
<< 0 5754428.5 Ops/sec
& 0xFFFFFFFFFFFF 5702267.5 Ops/sec
^ 0x000000000000 5610161.0 Ops/sec
Math.trunc() 2978837.8 Ops/sec
x - (x % 1) 3812316.0 Ops/sec
parseInt() 2985168.5 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()