Run details:
Mozilla/5.0 (Linux; Android 12; SM-S901E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.97 Mobile Safari/537.36 OPR/71.3.3718.67322
Opera Mobile 71
Android
Mobile
2 years ago
Test name Executions per second
floor 2585445.8 Ops/sec
~~ 4824398.0 Ops/sec
>> 0 4751072.5 Ops/sec
| 0 4858639.0 Ops/sec
<< 0 4747525.0 Ops/sec
& 0xFFFFFFFFFFFF 4325964.5 Ops/sec
^ 0x000000000000 4052137.0 Ops/sec
Math.trunc() 2222748.5 Ops/sec
x - (x % 1) 2349359.8 Ops/sec
parseInt() 2130897.0 Ops/sec
Script Preparation code:
Tests:
  • floor

  • ~~

  • >> 0

  • | 0

  • << 0

  • & 0xFFFFFFFFFFFF

  • ^ 0x000000000000

  • Math.trunc()

  • x - (x % 1)

  • parseInt()