What is TRIM support in Android 4.3 and why should you care?

Advertisement

When I first got my original Nexus 7, I loved it. Over time, however, it got slower and slower. As it turns out, I wasn’t alone. These tablets that started out snappy got gradually slower over time, until they were almost painful to use. Then Android 4.3 came along, and much of that slowness went away. Why? Google sneaked in a feature that’s slowly helping restore my sanity: Android TRIM support.

Let’s get some terminology and technology out of the way. When you think about how computers store files, you probably picture a hard drive (HDD), a rotating set of platters that stores data magnetically. This known as “storage space”.

Computers also use RAM to store data, but only temporarily. This is “memory”, just so you don’t confuse it with storage.

The computer I’m using to writing this article doesn’t use a traditional hard drive, instead it has a solid state drive (SSD). SSDs are very similar to the type of storage that our mobile devices use inside them: NAND flash, which is also “storage space”.

NAND Flash

Fragmentation occurs on traditional hard drives. When a file is deleted from a hard drive, its space is “liberated” when the file system erases the pointer to the start of the file. When the next file is to be written, the controller finds the first free spot on the disk, and starts writing the file. If the file is too big it fills up the empty spot, then puts a pointer to the next free spot on the disk, and then starts writing again. This process is repeated again and again until the file has completely been written. As more files are deleted and new ones written, the disk becomes more and more fragmented. As fragmentation increases, performance decreases. To remedy the situation we must defragment our hard drives — which takes quite a bit of time.

Data stored on NAND flash is saved differently than on traditional hard drives. Similar to HDD storage, NAND also keeps a map of where data is stored. When you delete a file, rather than freeing up that spot for re-use, most of the time it’s simply marked as “not in use”. The data is still there, and, more importantly, the entry in the file system is still there. (We just can’t access because it’s “not in use”.) That means as you write and delete files, the file map has to get bigger, and it takes more time to find the files that you’re looking for. While technically not “fragmentation”, this “I/O lag” becomes more pronounced with use– causing your device to operate more slowly the more you use it. This problem has been present in virtually every Android-powered device (and almost every other device that uses NAND flash for storage), we just haven’t noticed it too much — until now.

TRIM to the rescue!

SSDs operate much faster than their HDD counterparts, other a problem I had with one of my SSDs, I love the technology. On traditional computers, when you install an SSD there are a few things you want to do: you want to make sure your defragmentation program is set to NOT defrag your SSD (for the reason mentioned above), and you want to make sure your operating system has TRIM support, and that it’s enabled.

TRIM essentially goes through the file records and frees up blocks that you’ve deleted by telling the controller to stop keeping track of them. Now the controller only has to keep track of the files that haven’t been deleted, which speeds things up significantly!

TRIM support was included in the desktop Linux kernel in 2008. Microsoft’s desktop operating systems didn’t get support until 2009 with Windows 7. Apple didn’t pick up TRIM support on OS X until 10.6.8 in 2011. Android, however, didn’t pick it up until version 4.3.

Unfortunately, if your device isn’t running Android 4.3, it’s unlikely that your OEM has built in TRIM support. For those of you who have new devices running Android 4.3, you’re all set — TRIM is set up and running automatically. If you’re using a device that was running a down-level version of Android and you upgraded it to version 4.3, you probably want to do a factory reset to regain your lost speed, though you shouldn’t notice any further slowdowns if you opt not to start from scratch.

I’m a bit disappointed that Google took so long to implement this change, and that it was the original Nexus 7 that pointed out the need to do so. I’m glad the change has been made, and my original Nexus 7 is already operating much faster than it used to!

Advertisement

What's your reaction?
Love It
100%
Like It
0%
Want It
0%
Had It
0%
Hated It
0%
About The Author
Joe Levi
Joe graduated from Weber State University with two degrees in Information Systems and Technologies. He has carried mobile devices with him for more than a decade, including Apple's Newton, Microsoft's Handheld and Palm Sized PCs, and is Pocketnow's "Android Guy".By day you'll find Joe coding web pages, tweaking for SEO, and leveraging social media to spread the word. By night you'll probably find him writing technology and "prepping" articles, as well as shooting video.Read more about Joe Levi here.