• RichRatsch
    link
    fedilink
    English
    216 months ago

    I found this - increases battery life while apps open faster - confirmed via AccuBattery testing for a couple of weeks:

    You can force ART compiler’s AOT(Ahead Of Time) compiler to force compile all the apps ahead of time instead of JIT(Just In Time) which compile apps on the fly when you open and use different parts of an app.

    By default google uses a profile-based method to only compile the most used parts of an app. (You can find more info by reading the source which I’ve mentioned below)

    Remember forcing compilation take some time depending on how many apps you have installed.

    Only downside is this takes up little bit more storage space due to compiled .oat files are being larger in size compared to dex files.

    For example for me, apps installed without forcing compilation takes about 30GBs of space in total and after compilation it takes about 39GB.

    You can use this command to compile all the apps:

    adb shell cmd package compile -m speed -f -a

      • RichRatsch
        link
        fedilink
        English
        16 months ago

        No root needed, just ADB. I use shizuku and an ADB app to do it once a week on the phone, takes 30-60mins

          • RichRatsch
            link
            fedilink
            English
            26 months ago

            Yes - like every other time. With every App or system update these optimizations are “overwritten” by the system again…you don’t need to but I’m sure if you do it every 1-4 weeks you’ll see a positive impact on speed and battery.

        • @CCMan1701A
          link
          English
          16 months ago

          Might be something I do on my older pixel one

    • @aluminium@lemmy.world
      link
      fedilink
      English
      16 months ago

      Important thing to add here : Turn off automatic app updates. Otherwise the effect won’t last.

      Also on a sidenote - when your phone randomly decides to update apps, it can wreck your battery.

    • wilberfan
      link
      fedilink
      English
      16 months ago

      Nifty! Is there an option to selectively compile packages? So I could try it on the apps I use most often? 🤔

      • RichRatsch
        link
        fedilink
        English
        16 months ago

        Yes - absolutely - just google the adb command and you should get all the infos you need!