Run details:
Mozilla/5.0 (X11; Linux x86_64; rv:131.0) Gecko/20100101 Firefox/131.0
Firefox 131
Linux
Desktop
2 months ago
Test name Executions per second
floor 244692240.0 Ops/sec
~~ 245844608.0 Ops/sec
>> 0 245498640.0 Ops/sec
| 0 245931280.0 Ops/sec
<< 0 246044928.0 Ops/sec
& 0xFFFFFFFFFFFF 245759440.0 Ops/sec
^ 0x000000000000 246205616.0 Ops/sec
Math.trunc() 246567392.0 Ops/sec
x - (x % 1) 1225499648.0 Ops/sec
parseInt() 245225280.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()