Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 Edg/113.0.1774.35
Chrome 113
Windows
Desktop
one year ago
Test name Executions per second
floor 4007498.2 Ops/sec
~~ 7253949.0 Ops/sec
>> 0 7509856.0 Ops/sec
| 0 7292003.0 Ops/sec
<< 0 7469878.5 Ops/sec
& 0xFFFFFFFFFFFF 7421919.5 Ops/sec
^ 0x000000000000 7279922.0 Ops/sec
Math.trunc() 4237365.5 Ops/sec
x - (x % 1) 4868490.0 Ops/sec
parseInt() 4174799.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()