[Nook Color Android Development] leapinlar:
I learned another new trick for SD installations of CM9. Before I tell you what it is, I need to explain some things. It has to do with dalvik cache.

Dalvik cache is an area on your nook that helps the operating system open and run applications. The system copies information from the application's apk package and puts it in the dalvik cache for its own use when opening and running that application. It speeds up the system by having it available. The dalvik cache is not in a single location like many believe. It is actually in two locations. The cache for most of your system applications is located in the cache partition of emmc under /cache/dalvik-cache. The cache for all your installed applications are stored in the data partition under /data/dalvik-cache. The operating system keeps track of these and when a new application is installed or a system application changes (like when flashing a new nightly), the system updates the dalvik cache files. It does this when it boots. You may have noticed that sometimes CM7 took longer to boot than other times. And now with CM9 you may see a message that says "Optimizing Applications" as part of the boot. It is updating the dalvik cache. Often it is recommended that you wipe dalvik cache when you install a new nightly. This is to force creation of all new fresh cache files when it boots.

Normally this works all seamlessly and smoothly. But the introduction of SD installs has caused a wrinkle. When Verygreen created the script to make it possible to run a ROM off of an SD, he had it create new partitions on the SD. It has /boot, /system, /data and /sdcard (for media). The new ROM shares the /cache on emmc with the ROM on emmc. That is the problem. Each time either the emmc ROM or the SD ROM boots, the system looks at the dalvik cache on /cache and updates it if necessary. Sometimes the systems are fighting each other. When emmc boots, it sees cache files that don't match its system files, so it overwrites them so they do match. It then runs fine. The next time the SD ROM boots, it does the same thing. This is not a problem of things not running properly, because they do. The problem is the boot time for each system. Each time you switch between the systems, the cache is rebuilt.

There is a solution that works for CM9. You can add a setting in CM9 that tells it to write ALL of its dalvik cache files to /data. That way it is not sharing the cache with another ROM. Boot times are dramatically reduced.

Just add this line to local.prop in /data on the CM9 install.

dalvik.vm.dexopt-data-only=1

If you do not have a local.prop file on your system, create it with a text editor and put this line in it. Be sure to change the permissions of the file as I explained a few posts back.

This works whether CM9 is on emmc or SD, but is not necessary unless you are running one system on emmc and one on SD.

I have been running mine this way for a couple of days. I have noticed no difference in performance and boot times are significantly reduced.

EDIT: This works for CM7 also. I have my CM7 on emmc set to use all /data and my CM9 on SD set to use all /data. No dalvik cache files are written to /cache at all. There is no chance of tangling the files at all.