Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Chrome 126
Linux
Desktop
4 months ago
Test name Executions per second
floor 3204924.2 Ops/sec
~~ 5946545.5 Ops/sec
>> 0 5964991.5 Ops/sec
| 0 5948433.5 Ops/sec
<< 0 5856864.5 Ops/sec
& 0xFFFFFFFFFFFF 6042441.0 Ops/sec
^ 0x000000000000 5640774.0 Ops/sec
Math.trunc() 3205147.8 Ops/sec
x - (x % 1) 4102903.2 Ops/sec
parseInt() 3166233.8 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()