Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.124 YaBrowser/22.9.5.710 Yowser/2.5 Safari/537.36
Yandex Browser 22
Windows
Desktop
2 years ago
Test name Executions per second
floor 4326418.5 Ops/sec
~~ 8382395.5 Ops/sec
>> 0 8341403.0 Ops/sec
| 0 8312364.0 Ops/sec
<< 0 8316145.5 Ops/sec
& 0xFFFFFFFFFFFF 8267561.5 Ops/sec
^ 0x000000000000 8251841.5 Ops/sec
Math.trunc() 4246549.0 Ops/sec
x - (x % 1) 5395307.0 Ops/sec
parseInt() 4327246.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()