Motorola Milestone - How to make the best of it - Part 3

Well, in the 1st and 2nd parts of this Milestone experiment, I've shown you how to improve your phone's responsiveness and overall speed, while still running a stock Froyo. In this post I will show you how to fine tune the performance of your system so that it will improve your user experience, and provide more battery life.

Memory management

A further improvement you can do so that your apps can start faster, is to reconfigure the Android memory manager. By default, Android lets pretty much every app reside in memory, and only in very low memory situations, starts killing these apps, in order to free memory for another app you may want to start. This is in generally a good idea, and it allows you to better multitask because the more apps allowed to run simultaneously, the more apps that can multitask together. But that comes with at the price of new apps launch speed. Every time you start an app, the system frees RAM so that app can run properly. Next app you run gets the same treatment.

So basically an application start time looks like this:

AppStartTime = AndroidFreeRAMTime + AppLoadTime;

This happens almost every time.

What I will be trying to accomplish with the memory manager tuning is to remove the AndroidFreeRAMTime, by providing more free memory at all times. This means that you won't be able to run that many apps at the same time as you did before, so if you're heavy on multitasking, stop here, this tutorial is not for you. You can jump to the CPU tuning section instead.

So, first of all you need to grab an application from the Market called MinFreeManager. This application configures the memory management parameters for Android. Remember, you need root access to do these things.

The default system values provided were the following (you can always access them using the preset Default):

Foreground app: 6
Visible app: 8
Secondary server: 16
Hidden app: 20
Content provide: 22
Empty app: 24

the values I currently use are the following

Foreground app: 6
Visible app: 8
Secondary server: 16
Hidden app: 24
Content provide: 32
Empty app: 48

What are these values you may ask? Well, each value provides a free RAM threshold from where Android will start killing certain categories of apps. For example, it will kill the foreground app (the currently running one) if the free memory gets below 6MB of RAM. Visible Apps are apps that run in the background and so on.

You can use the Menu->Apply option to apply the values on the spot, and Apply at boot to apply them each time you start the phone.

The effect of these settings are constantly more free RAM, and so application load times are much lower. Android will still be killing apps in the background if the memory thresholds are crossed, but it won't influence your application start time. Now we practically removed the AndroidFreeRAMTime and we're left with:

AppStartTime = AppLoadTime

No more lags, translate into a snappier phone.

CPU tuning

If you choose to overclock your Milestone, this chapter will provide you a way to increase your battery life and speed the phone up a little.

Normally, Android uses CPU scaling so that when your phone is idle, or not doing much processing, the CPU clock is set to 125MHz by default. When the CPU is needed, the CPU clock is automatically set to 550MHz and stays that way until the CPU load is back to low values. Now I have overclocked the Milestone to 900MHz using a vsel of 63 in Milestone Overclock, so in my case the clock goes from 125MHz to 900MHz.
Even with this overclock, sometimes I felt a little lag when trying to do something. That was because the CPU took a little while to get from 125MHz to 900MHz. This is the performance part of the problem. The battery problem is that even if the phone is idle, if there is an app running with mid CPU load the CPU will stay at 900MHz until that app finishes. Now, you don't need an app that runs while your screen is off to finish as quickly as possible, right? So we need a way to tell the CPU to run at lower speeds when you don't need it.
Here is where SetCPU comes in handy. SetCPU allows you to specify the minimum CPU frequency and the maximum CPU frequency. It also allow you to define profiles with these 2 settings for various situations like when charging the phone, of when the screen is off, or even when you're low on battery.

In the main screen I've set the main online profile to have a minimum frequency of 500MHz and maximum of 900MHz. I have defined a profile for battery under 30% where I set the CPU to 125MHz up to 500MHz, another profile for screen off from 250MHz up to 500MHz, and another profile for charging where I set the CPU just like the one for screen off.

So basically, I managed to improve the speed of the phone while I'm operating it, because the minimum speed is now 500MHz and the switch from 500 to 900 when needed is much smoother than from 125 to 900. The screen off profile helps me conserve battery power when the phone's screen is turned off, the charging helps by lowering the time taken for a full charge, and the battery less than 30% helps when your baterry is low and you still need to operate your phone.