App optimization after updates is much quicker on Android N
Android N is changing the way app installation and app optimization are handled.
If you’re lucky enough to have a device that receives frequent updates, you may be familiar with the slight annoyance of having to wait for your apps to “optimize” for the new system version.
During this process, apps are pre-compiled in a process called Ahead-of-Time compilation, which basically ensures that apps are ready to run the instant you tap on their icon, as opposed to having to wait several seconds when you launch the app. This behavior was introduced with the ART (Android Runtime) virtual machine, which was previewed in KitKat and fully launched in Lollipop.
Before ART, the Dalvik virtual machine used Just-in-Time compilation, meaning that apps were compiled at runtime.
With Android N, Google is changing things up again. To cut on the long time required to compile apps when the system is updated (depending on the system, this may take 20 minutes or more), Android N now switches back to Just-in-Time compilation, but only the first times an app is launched. After that, Android N proceeds to compile apps Ahead-of-Time, presumably during idle times.
What does all this mean in real life?
- You won’t need to wait 5-20 minutes for apps to “optimize” after every update;
- Immediately after an update, apps will launch a little slower than normal (due to Just-in-Time compilation);
- After a few hours, app launch speed will return to normal (because the system compiled them Ahead-of-Time during idle time);
- New apps will be installed much faster, but the first time you launch them, they will open slower than normal (due to Just-in-Time compilation).
There you have it – a seemingly small, but very welcome improvement coming to Android N. For more on Google’s latest, make sure to check our complete Diving into Android N series.