Android 2.2 on an old HTC Magic (32B)

Because of the bad weather I tried to update my old HTC Magic phone to the new Android 2.2 today: I wanted to have the latest and greatest Android features Wink. However, some tweaks were necessary to get a real nice performance. One has to go through long forum posts to optimize the system etc., therefore here is a short summary. (These tips might be also helpful on other old phones, like the G1)
But it's worth the hassle: now the HTC Magic feels like an expensive, recent Desire phone !

Installing the system

CyanogenMod is the way to go. It is a community built distribution of Android 2.2, which allows you to install the latest Android versions also on older phones.
I already had an older CyanogenMod version installed (4.2), therefore I followed the upgrade instructions from the CyanogenMod Wiki. If you still have the original Android version on your phone, follow the Full Update Guide.
After installing the new CyanogenMod 6, I had some problems with Google apps. A full wipe (deleting all programs and settings) was necessary to get it working again.

Using swap

At the beginning everything went really well. But after installing plenty of apps, I recognized that the 192MB of RAM (actually only 96MB for the OS) are simply not enough for multitasking. E.g. the home screen was always reloading after using applications (especially after using the Market), it was even not possible to add widgets to the home screen ...
Enabling swap (additional space on the SD card used as memory) is one option. Many possibilities on how to enable swap are mentioned in this forum thread: Enabling swap, however, I finally used the Swapper 2 app from the market, which automatically enables your swap partition at each startup.
I created a swap partition of 32MB with Swapper 2 and set swappiness to 30 (these settings are very important) !

Further tweaks

Further performance tweaks are discussed in: Terrible performance on Magic. In Settings -> CyanogenMod -> Performance you can set some important system parameters: I'm using a VM Heap of 32MB, home locked in memory, dithering off, no JIT and no Compcache.

Conclusion

Everything runs really well now. The phone is always responsive, even heavy multitasking is possible and afterwards the home screen still appears immediately !
Also the speech recognition is really use-able now in Android 2.2 (german and english) ...