In order to fulfill the basic functions of our service, the user hereby agrees to allow Xiaomi to collect, process and use personal information which shall include but not be limited to written threads, pictures, comments, replies in the Mi Community, and relevant data types listed in Xiaomi's Private Policy. By selecting "Agree", you agree to Xiaomi's Private Policy and Content Policy .


[Tips & Guides] [MIUI with Tom #23] Optimize all APP for running it faster, smoother and with less battery power!

2020-06-23 02:38:23
5414 56

Hi Dear MIUI Fan's!

Today i'll show you how to Optimize all APP for running it faster, smoother and with less battery power! I'm not Android developer but i try explain all with simple word for better understanding for normal user. If you are ready than i can start!))

To this moment your device use ART JIT Compiler for running apps. ART JIT - is a Android Runtime Just in Time. This mean Android compile code every time for running app.
The JIT compiler complements ART's current ahead-of-time (AOT) compiler and improves runtime performance, saves storage space, and speeds application and system updates. It also improves upon the AOT compiler by avoiding system slowdown during automatic application updates or recompilation of applications during over-the-air (OTA) updates.

Although JIT and AOT use the same compiler with a similar set of optimizations, the generated code might not be identical.

But ART have profile compiler AOT (Ahead of Time) and he is not activate for app in android, but you can activate it from ADB SHELL.

Profile-guided compilation.
1.The user runs the app, which then triggers ART to load the .dex file.
  • If the .oat file (the AOT binary for the.dex file) is available, ART uses it directly. Although .oat files are generated regularly, they don't always contain compiled code (AOT binary).
  • If the .oat file does not contain compiled code, ART runs through JIT and the interpreter to execute the .dex file.
2. JIT is enabled for any application that is not compiled according to the speed compilation filter (which says "compile as much as you can from the app").
3. The JIT profile data is dumped to a file in a system directory that only the application can access.
4. The AOT compilation (dex2oat) daemon parses that  file to drive its compilation.

And now let's look at the pros and cons:

- Run APP faster
- Use less power

- Applications install a little longer (but not very noticeably)
- Use more storage

This is not recomend to use on device with 16\32 GB storage

If briefly the following commands make it possible to compile the code into an offline profile (.aot file) to run applications.
Do not forget!! The more applications installed, the more space will be taken after a new compilation.

Here is a resoult


Download Platform-tools and run CMD from folder Platform-tool
Enable USB Debugging and USB debugging Secure Settings in Developer options your device.

To force compilation, run the following:
adb shell cmd package compile

Common use cases for force compiling a specific package:

My-Package is apk name from Settings

Example command
adb shell cmd package compile -m speed -f com.tencent.mobileqq

If command right and all ok, you will see Success word after command

  • For one APP:
adb shell cmd package compile -m speed -f my-package

Common use cases for force compiling all packages:
  • Full:
adb shell cmd package compile -m speed -f -a

Example i compile all APP

Clearing profile data (revert all back)

To clear profile data and remove compiled code, run the following with ROOT:

  • For one package:
adb shell cmd package compile --reset my-package

  • For all packages:
adb shell cmd package compile --reset -a

Thanks to all for your time!
Also thanks to Admin MIUI Community!
Related thread:
[MIUI with Tom #20] How to use ADB and FASTBOOT Command directly from CMD!
[MIUI with Tom #22] How You Can Check ARB Version MIUI ROM before Downgrade!


Number of participants 9 Experience +109 Pack Reason

View Rating Log

2020-06-23 02:38:23
Favorites57 RateRate
Awesome tutorial and amazing efforts in simplifying the steps from u my friend as usual, Thanks for sharing
2020-06-23 03:17:24

Grand Master Bunny

arawak8 | from app


Thanks for sharing
2020-06-23 04:38:04

Intern Moderator

DaMgaSea | from Redmi Note 8 Pro


2020-06-23 05:00:00

Grand Master Bunny

Suter | from Redmi Note 7


Great tutorial again thanks.
2020-06-23 05:15:25

Master Bunny

Tom-GER | from Mi Note 10


great! thanks for sharing
2020-06-23 05:29:12

Mi Rédacteur

Mi-FE | from app


thanks for sharing
2020-06-23 06:04:05

Pro Bunny

Fansh1ne | from Redmi Note 8


Thanks 👍
2020-06-23 07:24:27
2020-06-23 07:36:12
Great work mate...
2020-06-23 09:15:03

Wizard Bunny

BeingBishal | from Mi 9T Pro


Helpful Tutorial!
2020-06-23 10:43:18
please sign in to reply.
Sign In Sign Up


Wizard Bunny

3 Days Check-In
7 Days Check-In
21 Days Check-In
40 Days Check-In
70 Days Check-In
Newbie Member
100 Коментарів
1000 Коментарів
100 Тем
New Home
10k Mi Fans
Redmi Note 7
Cast Away
20K Mi Fans
Mi Love U & I
Bunny Winner
20K Mi Fans
Best Mi
Android Q
50K Mi Fans
Mobile Photography Lover
70K Mi Fans
Eid ul-Fitr Mubarak
Brain Teaser
100K Mi Fans
Selfie Day
Mi 9T
Global Fans
My Country My Pride
Check in
Profile Medal
MIUI 9th Birthday
Global Community
Redmi 7A
better together slogan
Global Community
games discuss
Mid-Autumn Festival
200K Mi Fans
400K Mi Fans
300K Mi Fans
close up
Best Photo
10 years
Nepal "Happy New Year"
Ringtone Medal
The View Outside Your Window
Halloween Medal

Read moreGet new

Mi Comm APP

Stay updated on Mi Products and MIUI

Copyright©2010-2020, All Rights Reserved
Quick Reply To Top Return to the list