I Am a Flasher

I love to flash my phone. There, I said it. I’m out.

I’m a tinkerer. I love to learn how everything works. And once I understand how things work, I try to make them just a little bit better.

I currently own a Verizon Samsung Galaxy Nexus (toro). I used it stock for a couple of weeks, and then I rooted it and began exploring alternate ROMs. Verizon was dragging its heels bringing the latest version of the Android operating system to this phone and I wanted to experience the best Google had to offer.

For months, I tried various ROMs and kernels. I’ve probably flashed the phone over a hundred times. I eventually settled on Cyanogenmod 10.1 nightlies and either CM kernel or Franco kernel, depending on mood.

Over time and successive flashes of nightly builds, my phone became inexplicably slower and slower. It would stutter, pause, delay. Very frustrating, and as I was following all the best practices for flashing alternate ROMs, very puzzling.

I was using the same process with my Asus Nexus 7 tablet and its performance was worse than the phone’s.

A fan of the Stack Exchange network of sites, I posted this question to the Android Stack Exchange. I’ll quote from myself here:

I have a Verizon Galaxy Nexus (toro). I am running Cyanogenmod 10.1 ROM nightlies and I use CyanDelta Updater to stay up to date.

For a period of about 3 weeks, I updated to the latest nightly nearly every day using CyanDelta. Sometimes I’d download the full ROM instead of using CyanDelta. During this time, I never wiped the device (aka factory reset). I just applied the new release on top of the old.

Recently, my phone’s performance degraded significantly. There were long delays unlocking, long delays switching apps, long delays doing just about everything. The phone would freeze up, and the OS would ask if I wanted to end a process because it wasn’t responding. My podcatcher would stutter while playing.

Instead of switching to another ROM, I decided to first do a full wipe (factory reset). I used Titanium Backup to back up my user apps and data. In TeamWin Recovery, I did a factory reset, flashed the same CM 10.1 nightly I was running previously, restored my apps using Titanium, signed into accounts, etc.

My phone’s performance has been completely restored. It’s like night and day.

My question is: Why did that work? What is it about applying successive ROM versions that could cause a slowdown that a wipe would fix?

I love my new level of performance, but I also enjoy keeping up with the latest releases. It would seem I can’t have my jelly beans and eat them too. Now I’m reluctant to flash any updates without doing a full wipe.

I didn’t receive any good leads on answers. Every now and then I’d google for solutions. Late last week, I think I may have found a possible answer. I followed up my own question with an answer:

I’ve come up with one potential answer myself: TRIM

Solid state disks (SSDs) and some flash memory require the operating system to perform a kind of housekeeping task to maintain the efficiency of the device.

The operating system command TRIM is explained in this AnandTech article:

Its applicability to certain Android devices, including my Samsung Galaxy Nexus and ASUS Nexus 7 is explained in these XDA Developers threads:

An XDA member wrote an app called LagFix which purports to exercise the TRIM maintenance function, thus restoring write performance for the device.

Since I recently performed a complete factory reset, I’m no longer having performance problems and thus I can’t directly corroborate the purported benefits of LagFix. If I’m in a position where performance is suffering, I may do some benchmarking and see if LagFix improves the situation.

Please be aware if you plan to try LagFix that there are some devices that have chips that do NOT play nice with this utility. These chips have what’s come to be called a BrickBug, and if you run LagFix on one of these devices, you will irrevocably brick your device.

I highly recommend you follow the advice and read the LagFix FAQ. It points to a utility which can tell you if your device contains a chip that may suffer from the BrickBug.

One aspect I haven’t figured out yet is why a factory reset might restore performance. I’d like to figure out whether a factory reset performs a TRIM cleanup. My meager understanding of the TRIM process from my experience using PCs and SSDs is that if the OS doesn’t have integrated TRIM support, you need a separate utility to periodically sweep the disk.

I purchased the pro version of LagFix to support the developer and I have running on a schedule. I’m hoping that’s the end of my performance woes.