Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36
Chrome 89
Windows
Desktop
3 years ago
Test name Executions per second
floor 1833582.0 Ops/sec
~~ 3187651.0 Ops/sec
>> 0 3136150.0 Ops/sec
| 0 3139069.2 Ops/sec
<< 0 3155591.5 Ops/sec
& 0xFFFFFFFFFFFF 3162943.2 Ops/sec
^ 0x000000000000 3137570.2 Ops/sec
Math.trunc() 1795748.8 Ops/sec
x - (x % 1) 2131515.5 Ops/sec
parseInt() 1813885.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()