A Few Small CyanogenMod Firmware Optimizations

| No Comments | No TrackBacks

I've been running the stable 4.2 series of CyanogenMod since around the day of its release and I am been very happy with all of them. It has been a huge performance improvement over 4.1.9999.

I only have one real genuine complaint about Android and my G1: the lack of RAM. Most of the time I really don't notice it, Android mostly does a good job of closing old applications to make room for new ones.

My old Palm OS phone, and presumably the iPhone, only run one application at a time. That way is fast and saves memory. Android does a pretty good job at compromising between old school application switching and full on multitasking. Android will run as many applications as it can concurrently. If the application you are running needs more memory, Android will start closing the background applications.

Applications are warned that they are going to be closed. That gives them a chance to save their state so that you can just continue where you left off the next time you open it.

For most applications this works very well for me. For one application, this is a nuisance. I've been using Meebo as my instant messaging client. Unfortunately, it was constantly being pushed out of RAM and I was being disconnected. I've been able to drastically reduce how often this happens.

Three Ways To Increase Available Memory

You can allocate swap space on your SD card. I've seen a lot of people say that this works very well for them. All SD cards are slow. It is certainly possible that mine is extremely slow. I've noticed that if you make a large swap space, Android will treat it the same as free high speed RAM. I tried running with a 64 megabyte swap partition on my SD card. With that much swap it seemed like no applications were ever closing. The more applications I ran the slower the phone got until it was barely usable.

If you are going to try using swap space on your SD card I would recommend either using a smaller swap partition and/or decrease your /proc/sys/vm/swappiness down into the 10-30 range.

I much prefer using compcache for swap. I've been experimenting with it for about a week now. I started off with my swappiness set to 10 and my compcache set to 10 megabytes. I have slowly been increasing both and waiting for the phone to perform poorly. I'm currently running a swappiness of 45 with a 26 megabyte compcache.

With swappiness set to 45 I seem to always have 5 to 10 megabytes of free swap every time I check. When I tried setting swappiness to 50 it was always full and the phone felt quite a bit soggier. The command rzscontrol /dev/block/ramzswap0 -s is currently showing that I'm swapping out 20868 KB with a MemUsedTotal value of 8252 KB. I'm happy with that, that's better than a 2:1 savings. It means I am trading approximately 8 megabytes of ram and a few extra CPU cycles for an extra 12 megabytes of ram.

You can also run a kernel that has been patched to steal RAM from the video chip. I am running a kernel binary that I found on the xda-developers forums. It is giving me approximately 10 extra megabytes of RAM, which is a little more than a 10% increase. I haven't had any lock ups or resets with these kernels and all of my games and my video player all work fine.

So Just What Does All This Mean Anyway?

The stock firmware leaves the device with about 95 megabytes of memory available to the kernel. The patched kernel gives you an extra 10 and in practice compcache can give you at least another 10. That is a good solid 20% increase in available usable memory.

According to ps, most of the applications I run use between 8 and 20 megabytes of memory. That means the extra memory could mean about 1 to 3 more applications can be left running, depending on how heavy they are.

So far I haven't had Meebo close on me with this kernel and these compcache settings. Unfortunately, I was only relying on Meebo for one solid evening so far. I wasn't using anything more than my email and browser that night, it isn't quite enough, though. Opening something heavy like Google Maps with traffic still often pushes Meebo out.

The latest couple of CyanogenMod firmwares have an option to try to keep the home application in memory. I plan to investigate to see if there is a way I can do the same sort of thing with Meebo.

No TrackBacks

TrackBack URL: http://blog.patshead.com/cgi-bin/mt/mt-tb.cgi/27

Leave a comment

Pages

  • images
OpenID accepted here Learn more about OpenID

December 2009

Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31