Wednesday, August 15, 2012

Android at the Speed of Lightning


What to do to make Android run faster? Faster processor, of course, and faster GPU - not. As more experienced desktop users already know, main bottleneck is usually one less obvious component: memory.

As a user, I am quite demanding: I typically use multiple applications and switch between them quite often. This puts a lot of strain on the Android memory management. It constantly has to kill the applications just to have enough memory to start another. Sometimes, memory is so filled up that the operating system must kill launcher to make some space for the applications. This is easy to notice: if you press the home button, your home screen will be blank and you will have to wait for some time for icons to appear. It is also annoying: you just pressed home button to start another application and now you have to wait.

This shows that the mobile phone, as any other computer, must be the optimal blend of all of its components. Fast processor will be slowed down by the lack of RAM, high-resolution screen will need high-performance graphics, and all those will not worth much if battery drains quickly. To get the right combination, you must outsmart phone manufacturers, because they will pump up features that everybody understand (resolution, thinness, number and frequency of processor cores) at the expense of less obvious one (RAM size, adequate battery capacity).

There was a lot of talk about "Project Butter" recently, which intention was to make Android user interface super-smooth. On Nexus S with 512 MB of RAM it didn't happen. 4.x versions of Android are more memory-hungry than the older 2.x, so lack of memory hinders speed improvements. That is why most of the new cheap phones still have 2.3, and why manufacturers claim that Android update of older phone will ruin user experience. In many cases, that is actually true. 4.x is faster than 2.x, but only if it has enough resources at disposal, otherwise it will choke. 512 MB is barely enough. 768 MB is necessary to run it smoothly.

Classical solution to cut memory footprint is to try custom ROMs. They use different tricks to shake off some of the fat. There is even one ROM, Slim ICS, which sole purpose is to make Android as small as possible. While this is a way to go for enthusiasts, I wondered what could be done without unlocking and installing custom ROMs. My phone is under warranty and I don't want to fiddle too much with it.

Most effective way would be to remove as many resident applications as possible. While regular applications come and go, resident applications occupy memory constantly, reducing memory available to other applications and worsening swapping effects. There are some usual suspects, like applications that constantly keep unnecessary services in memory (hint: Facebook). Uninstall all such applications that you don't really need. What's left are some core services, which still can consume a surprising amount of RAM:
  • Launcher. Stock launcher is quite memory hungry. It can take up to 70 MB of RAM (14% of 512 MB).
  • Keyboard. While standard keyboard consumes modest 15 MB of RAM, smarter keyboards are more demanding: SwiftKey X and Swype need about 30 MB, while latest version of SwiftKey, 3.0, takes as much as 50 MB. While they are both big help for fast typing, they are both obstacles for fast phone.
  • Browser. Although it is standalone application, it is often called from other applications. As it runs in parallel with other heavyweight application, reducing its memory footprint will make phone snappier.

I already covered browsers (in Android's Fastest Browser) and keyboards (in Writing with Thumb: Android Keyboards). Problem was to resolve one piece of puzzle that bothered me for some time without the right solution: the launcher. Although there are highly acclaimed low-resource launchers as Nemus Launcher, I didn't really noticed much difference. Those launchers are usually lacking some features so I would ultimately revert to stock launcher. Until Slim ICS gave me a hint.

Slim ICS recently replaced Nemus Launcher with Lightning Launcher. It is a strange beast and it takes some time to understand it. Laucher is modular, which means that every piece of functionality is installed as separate application. Currently, I have launcher, setup (it is separate application!), and LLW Any App Widget (again, separate application needed just ti be able to put standard widget on the home screen). You can additionally install widgets (each widget is separate app) and two different pagers, if you like paged launchers. While initially confusing, this approach has clear benefits: applications are not loaded into memory unless they are needed. Feature-wise, it is not so slim; it supports folders and layout is highly customizable. There are many more interesting features, but I will focus on memory usage: Lightning uses about 20 MB less than Jelly Bean default launcher.

I shaved 20 MB off launcher and another 15 MB off keyboard. That is 7% of available RAM. Although it doesn't sound much, it really made my phone much more responsive. Being lean is always good idea.

No comments:

Post a Comment