Improved App Optimization in Android N

Editor’s Note:  This post is concerning a feature in Android N.  As this new version of Android is still in development, the features described in this post could change between the time of the writing and when it is released to the public in the summer of 2016.

One of the exciting changes that appears to be coming in Android N is the way that apps are optimized after a system level update.  The change means that you will be able to access apps on your device faster than you currently can with Marshmallow, albeit with them running a bit slower.  The change means that when you update your device with an update to Android itself, you should be able to use your phone much faster than you can today with Lollipop or Marshmallow.

The item I am talking about here has to do with the banner you get after you update Android.  Currently you get a banner that says “Optimizing app x of y” and depending on how many app you have installed, this can take upwards of 10 minutes.  The reason is that Lollipop and Android use what is known as Ahead of Time compiling.  This means that the OS compiles and optimizes any apps you have installed on your device prior to giving you access to it.  The logic behind this is pretty straightforward:  Once your phone has installed an update and optimized the apps, they all run at maximum efficiency as soon as you tap the app’s icon.  But that comes at a cost.  It means that in order for you to be able to use your phone after an update, this compiling has to happen.

Android N
Android N

In Android N, this appears to have changed to a more hybrid model between Ahead of Time and Just in Time compiling.  Just in Time, as the name hints at, brings you the ability to launch apps immediately after an update to Android – but at a cost.  It will run slower initially until the compiling of the app is completed.  Then things will return to normal.  The logic behind this is straightforward too:  If you have updated and then suddenly need to get to your boarding pass for your flight, you can get it quicker than waiting for Y number of apps to compile on your phone.

We can debate if you should update Android while in an airport… but that’s a different discussion. 🙂

After you have updated Android and your phone is sitting idle, then the OS uses the Ahead of Time process to optimize apps that you haven’t accessed in the background.  It is a really elegant solution.

Another interesting side effect of using Just in Time compiling is that apps that are newly installed will install and be available much faster than they are in Lollipop or Marshmallow, but they will run a it slower the first time you run them.  My experience with suggests that this too is a double-edged sword.  Yes you can get to that app faster but it will run slower until the compiling is complete.  That’s no big deal on say Google Docs or Microsoft Word.  On Real Racing 3 however?

It will be interesting to see just how this gets fully implemented in Android N once it is generally available later this year.  I suspect that is will be an area we see a fair amount of tweaking during the beta process.