Tag: swap

Tuning a T-Mobile G1 with Cyanogenmod 6 (CM6) for optimal performance (no swap, compcache, or 10MB hack needed!)

IF THIS GUIDE HELPS YOU, PLEASE COMMENT. Last updated 2012-01-24.

[UPDATE: Added Android keyboard bug note; added step to remove ADWLauncher.]

[UPDATE 2: The launcher “Zeam” seems to be even lighter than LauncherPro.  Changing VM heap size to 12 and enabling JIT seems to improve the phone’s AVERAGE behavior considerably. While slower than after the initial boot with VM heap size = 24 + no JIT, the latter combination seems to slowly degrade performance until a reboot is needed, while the new settings don’t have such an effect. However, my phone is literally FULL with apps, so if you run lighter (i.e. remove Maps and Google Voice, don’t have many apps) you may prefer the 24MB heap size.]

[UPDATE 3: You REALLY should perform the EzTerry 14MB RAM hack which makes a massive difference, but requires more advanced work and is beyond the scope of this tutorial.]

I managed to FINALLY get my T-Mobile G1 to perform very well while running Cyanogenmod 6 (specifically I’m running CM 6.1-RC1 for Dream/Sapphire), and because it’s been such a difficult and elusive process, and people all over the Cyanogen forums have been screaming about often lackluster T-Mobile G1 performance (due to the 96MB of OS-usable RAM installed in the G1) I should share everything I’ve done to get this far.

What’s so different about my performance as compared to others who report GOOD performance with a CM6 G1 is that mine had started to become quite poor, which is often the case with these phones and custom ROMs.  Everything would work great after a wipe+flash, which erases pretty much everything, and then over the course of a few weeks the performance would drop until it became laggy and very annoying.  Reports of dialer/phone appearance on an incoming call lagging so severely that calls would be missed are not uncommon.

How does it perform?  Well, most of the time the launcher doesn’t unload, meaning my icons appear immediately when I go “home.”  When it does unload, it’s very quick to come up.  Application load times are drastically better and there is no noticeable lag in most usage cases.  In particular, the 3D gallery, which is very notorious for being slow to come up when using the default CM6 settings, pops up in approximately 5-6 seconds, and all of my 150 or so pictures on my 4GB Class 4 microSD card pop up in another 4-5 seconds (the first gallery startup makes thumbnails and is significantly slower, but we can ignore that since it’s largely a one-shot deal.)

BIG FAT UGLY NOTE TO ALL G1 CYANOGENMOD USERS: The default CM6 Dream/Sapphire settings are NOT OPTIMAL FOR THE T-MOBILE G1!!! I will be telling you to change settings in the “Performance settings” which has a BIG WARNING when you open it about dragons and voided warranties. Don’t worry, you’ll be safe with my setting changes.

First and foremost, you need to get some apps from the Market.  Search for and install the following:

  • Zeam (smaller) or LauncherPro (nicer) to replace ADW.Launcher
  • Home Switcher for Froyo
  • ConnectBot (not strictly needed as you can use Terminal Emulator, but ConnectBot makes things easier)

Now we’re ready to clean up the software on the G1 and get it performing like it was meant to.  Follow these steps:

  1. Run Home Switcher and set the default home app to LauncherPro or Zeam.
  2. Hit Home to get into LauncherPro, then hit Menu > Preferences > Advanced Settings > Memory Usage Settings > Memory Usage Preset, and select Light.
  3. Home > Menu > Settings > CyanogenMod Settings > Performance Settings > OK > Compcache RAM usage > Disabled
  4. Uncheck the following:  Use JIT, Enable surface dithering, Lock home in memory.
  5. Check Lock messaging app in memory.
  6. VM heap size > 24m
  7. You have a G1, so you probably don’t need the on-screen keyboard, and it takes up at least 5MB of RAM even if you aren’t using it.  Decide whether you want to have the on-screen keyboard or if you want to be stuck with only the 5-row slide-out keyboard. For me, the choice was obvious because the on-screen keyboard really, really sucks, so I turned it off. If you can do without the on-screen keyboard (and I highly recommend this step) then deactivate it: Home > Menu > Settings > Language & Keyboard > uncheck Android Keyboard.  [UPDATE: Looks like this box checks itself automatically when you reboot. Just uncheck it whenever you reboot; it’s probably a very minor bug in CM.]
  8. WARNING: the safe parts are now done and over with; in the next steps we will be stripping out Android apps that come with the CM6 system which can be sort of dangerous. Also, reflashing or upgrading CM will put these right back in place and you’ll need to repeat these steps.  (Apps exist to do these things more safely but I didn’t use them myself.)  If you are not comfortable with removing unnecessary system apps, stop here.  This page is very helpful reference for this: http://wiki.cyanogenmod.com/index.php?title=Barebones
  9. We need to remove Voice Search, Amazon MP3 (if applicable), Google Quick Search Box, and News and Weather. These apps seem to run themselves or a system service component all the time, and that means using memory unnecessarily.  (Plus, no one seems to use them anyway.)
  10. Run ConnectBot. Go through their tutorial if you like. Pay attention to how right-alt types a forward slash and right-shift performs “tab completion” of file names for you (in bash). These are very handy for typing the often long app file names. When you can open a new connection, change the connection type from “ssh” to “local” and hit [enter] in the empty box to the right of it.
  11. At the $ prompt, type su and hit enter. This will prompt for superuser access; allow the action to proceed. You’ll be changed to a # prompt.  Type bash and hit enter.  This will give you more junk before the # but otherwise it’s the same.  (Using bash gives us the handy tab completion, remember?)  Type the remaining steps in exactly as they are written, one per line.  If Amazon MP3 is not installed (on some versions) then the Amazon lines may return errors.  Note that after running any of the “pm uninstall” commands you will need to push the trackball button and then the letter “c” after you get “Success” to continue. For some reason it never seems to return to the command prompt if you don’t do this, but whatever.  Remember, you can hit right-shift to have the system complete the file names once you type enough characters.
  12. mount -o remount,rw /system
  13. rm -f /system/app/com.amazon.mp3.apk
  14. rm -f /system/app/GoogleQuickSearchBox.apk
  15. rm -f /system/app/GenieWidget.apk
  16. rm -f /system/app/VoiceSearch.apk
  17. pm uninstall com.amazon.mp3
  18. pm uninstall com.google.android.googlequicksearchbox
  19. pm uninstall com.google.android.apps.genie.geniewidget
  20. pm uninstall com.google.android.voicesearch
  21. [UPDATE] ADWLauncher apparently will continue to eat memory in the background even though you switched to LauncherPro.  Use the following command to make ADW go away (note you can reverse the process if you have to, or update/reflash):
  22. mv /system/app/ADWLauncher.apk /data/

[UPDATE: Don’t remove ADWLauncher; if something goes wrong and you remove Zeam or LauncherPro, you’ll have NO LAUNCHER and a reflash will be forced upon you. The 14MB hack will relieve some of the memory pressure and make this unnecessary anyway.]

Type “exit” three times to leave the console.  After all of this mess is completed, I’d suggest rebooting the phone to make sure everything is in a consistent state.  I noticed that lots of services run at initial startup, so don’t be alarmed if the G1 is slow for about a minute after the launcher appears.  I have found that deleting my Messaging threads and limiting them to 100 messages per contact significantly boosts Messaging app performance. Since Messaging is locked in memory, you might want to regularly clean it out to maintain optimal performance.  The same goes for the various Browser caches and saved information, though cleaning these will only make Browser perform better and has no effect on the entire phone.

After doing all of this, I noticed that my phone boots faster and is extremely responsive all of the time.  Even when the system reloads LauncherPro or starts an app from scratch, it’s MUCH faster to do so.  AGAIN, note that I am NOT using ANY of the following performance hacks:

  • Compcache (not even 10%, it’s DISABLED)
  • The Dalvik JIT compiler
  • Swap file on the SD card
  • 10MB RAM hack
  • Task/process killer applications (they’re unnecessary anyway)

Please leave a comment with feedback if you followed these directions.  I can’t provide help (that’s what the CM forums are for), I just want to know how it works for others.  Thanks!