Many users of the original Nexus 7 remember how slow the device could get after a few months of heavy use. At least part of this problem has to do with the way NAND flash stores and deletes data. Android 4.3 comes with a little-hyped feature that could be huge for performance in the future – TRIM support via fstrim.

2013-07-29 20_33_28-b87937cdea689594a293979b30b13054e7455dee - platform_system_vold - Git at Google

There were ways to run the fstrim command on devices before, but it required root. Then, by the time you realized you needed it, the file system was probably already a mess. TRIM is important in solid state storage because deleting a file doesn't really remove it, the storage device simply allows you to re-use the blocks. The controller considers that data still valid, so as you write and delete more blocks, the NAND controller has to keep track of a more complex map of locations in the file system. The result? Slow storage.

TRIM goes through your flash storage and tells the controller to stop tracking those blocks of data you have "deleted." The controller will then (ideally) schedule that data to be swept up in the next garbage collection cycle. This process is now happening in the background of Nexus devices running Android 4.3. It should even show up in the logcat on occasion.

The commits in AOSP that list fstrim are in platform/system, so it's safe to say this is going to be a part of all Android devices on 4.3 – not just the Nexus series. The fstrim application will tick along in the background, so it might take a while for any difference to become clear on already sluggish devices. However, fresh phones and tablets should not suffer from the same kind of slowdowns we saw with the first N7 – assuming the storage controller is up to the task.

[AnandTech, AOSP – Thanks, Nagy]

Ryan Whitwam
Ryan is a tech/science writer, skeptic, lover of all things electronic, and Android fan. In his spare time he reads golden-age sci-fi and sleeps, but rarely at the same time. His wife tolerates him as few would.

He's the author of a sci-fi novel called The Crooked City, which is available on Amazon and Google Play.

  • Alex

    Wow, this is awesome news actually, Good job Google

    • Alex

      Also, wanted to add, on my Nexus 4, i would have terrible lockscreen freezing when first turning on the phone. It would happen like once out of every 5 times i turned the screen on, even more sometimes, it was a huge PITA. Haven't experienced it in 4.3 yet :)
      Doubt it has anything to do with trim, but it's fixed so im happy

      • Ryan Stewart

        Were you coming out of a charging state? Ive noticed on both my N4 and N10 that trying to bring up the lock screen right after pulling it off of a charger (POGO on the N10 and Qi on the N4) it would take a second. But I ONLY noticed it when coming off of the charger.

  • Tamadrummer94

    How long? Cuz from what I've heard 4.3 isn't exactly a godsend for the old Nexus 7.

    • techpunch
      • Dario

        Exactly, 1-2 days doesn't mean squat. Even this article mentions months before the degrading effect really kicks in. Placebo effect at this point. Sorry, I just don't believe it after my Nexus 7 experience. Lets wait until the glee and excitement of new hardware and software wears off before we start saying the problem has been resolved or vastly improved.

        • Adrian Zugaj

          I don't know if you understand the issue being illustrated here. The storage speed improvements mentioned are primarily in reference to the old N7, not the new one.

          • Justin W

            I don't think he truly understands how TRIM affects flash/SSD type storage systems. This will greatly improve both older devices in reducing the I/O lag as well as newer devices in preventing the I/O lag from ever appearing.

    • epsiblivion

      some are saying there is definitely perf improvement with the addition of TRIM support. that only fixes part of it since 4.2.2 still has remnants that bog it down still present in 4.3 I guess. but TRIM does make a difference.

    • http://www.AndroidAllies.com/ Max M.

      I only used mine for a day or so on 4.3 before I sold it, but I would say there was a good improvement. And no, it wasn't just because it was a fresh wipe and flash. I had been doing that every few days for weeks because of how horrible it ran.

      My Gnex has been on 4.3 since Friday and it has had great improvements. I don't hate it anymore. (:

      • Dart

        It's weird. I never ran into the performance issues on my Nexus 7 once I updated it to Android 4.2.2.

        Prior versions of Android 4.2, yes, I did see slight lagging, but Android 4.2.2 fixed it for me. Of course I do notice an even smoother UI on Android 4.3 too.

    • PhineasJW

      Yeah, I'm not really seeing the improvements on mine. Remember, if anything it only helps the flash memory.

      My N7 still has major touchscreen bounceback from misinterpreted swipes.

      Back is still spongey and creaking. 4.3 didn't fix this. :)

      Still gets choppy when doing any sort of multitasking, like downloading something and pressing home or swiping.

      • Rob Mahon

        That's THE thing I'm seeing as a benefit on the new N7 so far. Sure, benchmarks show it's a bit faster, but in general use, it's not really noticeable. Until downloading something. Then it doesn't stutter like the original N7 did. Far improved.

  • Anthony Restaino

    I must say Android 4.3 has certainly made me rethink selling my OG Nexus 7 for the new one... It's running so stellar now.

    • http://www.AndroidAllies.com/ Max M.

      It's made me rethink selling my Gnex for the Moto X. I might wait until the next Nexus at this rate.

      • Justin Swanson

        I'm waiting for the next Nexus :D

      • Dart

        Exactly what I'm doing. Waiting for the next Nexus while using my GSM Galaxy Nexus.

        Android 4.3 is amazing on the Galaxy Nexus. Although I never had lag or slowness on Android 4.2 on it, but Android 4.3 is like Project Butter Advanced.

  • Robert Macri

    4.3 truly saved my galaxy nexus. It hasn't ran this fast since I first installed 4.1.

    Im no longer in a rush to upgrade. It did take a day or two for the performance to improve but wow the difference is amazing.

    • yepyepyep

      Same here! 4.2 was realy frustrating performance wise on the Galaxy Nexus but now it runs so much smoother. No more freeze-unlocks, no more stuttering during typing etc.
      Thanks Google

    • Dart

      Yeah. Android 4.3 is awesome on the Galaxy Nexus (and my 2012 Nexus 7).

      I didn't really experience the lag people are describing in Android 4.2.2, which I am thankful for. However, Android takes both phone and tablet to a new level of smoothness.

  • miso_sori

    Am I overly optimistic to think this might eventually clear up my unrooted TF700?

    • Ryan Stewart

      You think ASUS is going to upgrade it?

      • mldi

        They've been pretty good so far.

      • miso_sori

        Yes, I do.

  • whispy_snippet

    Good to know. Very interesting.

    • Trueblue711

      Could be because they don't want to bring attention to or acknowledge how big of an issue it was in the first place.

  • Rob

    This helps to explain why my older CDMA Galaxy Nexus is at times slow as a snail but my newer GSM Galaxy Nexus is speedy as hell.

  • brutalpanther

    The new nexus 7 is a beast.good job google and asus.

  • Ancan

    4.3 brought drastic improvements for my N7 speedwise. Much beyond what placebo effect can explain. Chrome browser was unusable before, now it's my preferred browser, and the input lag I had when typing is gone.
    No wipe, fresh restart or anything, but I let it sleep a day or so with the charger connected to let fstrim run through.
    Now if they'd just fix the baseband_xmm_power wakelock, all would be fine.

  • Dan Caseley

    Cracking news. I've been using LagFix on my ICS & JB devices for months to fill this gap.

    • Alex

      And many were saying that app was a placebo...pfff

    • Glen

      Is there any apps like this for a Samsung S2? Both LagFix and ForereverGone show up as incompatible

  • deltatux

    I'm surprised that Google didn't implement fstrim since Android 2.2 (with garbage collection available)... this utility has been available for Linux since at least 2010...

    • naysayer

      Garbage Collection has nothing to do with it. Also, earlier devices weren't affected. It is the storage in the N7 and newer GN that slows down without this feature.

      • deltatux

        I know garbage collection has nothing to do with it, but if they could introduce garbage collection in Android 2.2, why couldn't they also include fstrim (it was available for Linux since 2010)? fstrim enhances any system with NAND storage, it could have helped with older devices like the Nexus S as well. Through time, even newer devices like Nexus 4 and the new Nexus 7 could fall into the same performance problems without fstrim.

        • naysayer

          I'm not sure this is true. From what I read in the forums there are just a few chips really affected by the missing trim. The N7 seems to be unusable once you have used up a certain amount of storage. This is also true for some Galaxy Nexus. Maybe users of other devices see a tiny benefit but this is certainly not a game changer unless you own one of these devices

  • mrjayviper

    i wonder if this would fix the shitty storage Asus put on the transformer series? :/

    • Ivan Myring

      Maybe there was a bug

    • http://twitter.com/JorgeBranco_aus Jorge Branco

      God I hope so. Was just trawling this for suggestions before googling


    This is awesome. I mean ... truly awesome. How come we only discover that now?

    • mrjayviper

      very surprise too as the "trim" feature has been a must-have in SSD for sometime (since 2 years ago?). I doubt Google just heard of it. Why was it only implemented recently?

      • DETOMINE

        Any idea why it doesn't appear in the changelog for 4.3? I mean, not counting BLE and ES 3, it is the most important feature in 4.3, don't you agree?

  • Ivaylo Stoyanov

    This feature can potentially hardbrick Galaxy S2s and Notes with defective eMMC chips. I hope custom ROM developers will take this in consideration when developing for these devices.

    • Trueblue711

      What happened with those models? Also, wouldn't a defect in Samsung's products be their own fault/problem, not Google's?

      • Ivaylo Stoyanov

        Did you even read my post entirely, or did you just stop after the first sentence? Of course it is not Google's fault. Since the S2 is still pretty popular and Samsung won't update it to 4.3, custom ROM developers will probably try and port 4.3 for it. They should disable fstrim, as it could effectively hardbrick units with defective eMMCs.

        Take a look at the first paragraph:

        • Trueblue711

          Wow, you need to calm the f*ck down. I was asking about the defect out of curiousity -- I don't follow the GS2/Note lineup, so I didn't know about that.

          With that being said, my point still stands: Custom ROM developers shouldn't have to go out of their way to make changes for Samsung's defects, much like how the Clockwork Mod devs don't make their Helium app available to Moto users because of a bug in Moto's ROMs.

  • Tyler Jones

    So will this save my N7? Its old but ive never used it that much so it hasnt slowed down too much. Hopefully this means that it wont get any worse.

  • saltyzip

    Out of interest does IOS have such a feature?

    I assume Apple devices also show slow down over time, if not.

    • Samsung Fanboy

      no such feature and yes they do slow down as well and freeze. apple fanboys always pretend that iOS runs flawlessly and that's simply not true.

      • mrjayviper

        Link? Thanks

    • Irick

      The short answer is Yes.

      The long answer is that the HFS+ file system that iOS uses has a specific hook via IOStorageFamily in versions based on OS 10.6.8 and above.

  • Chev Chelios

    I used to use Forever Gone on my stock, unrooted 16GB Nexus 7 (2012). When the storage goes under 3GB, even browsing in Chrome becomes so unbearable and for a time I wasn't using the tablet for browsing, just for some apps, games and Google Now. After using that app, even if it only has 2.5GB left, the difference is night and day. Browsing is definitely faster. I also used AndroBench for storage benchmarks. Numbers don't lie!

    Anyway, that was when I was on 4.2.2. After updating to 4.3, it was still fast and the laggy widget gallery is gone on the stock launcher. However, when I ran Forever Gone again, my Nexus 7 became so freaking slow I had no choice but to factory reset it. Now, it's fast and stable and I have lots of storage left. One regret though, even if I used Helium to back up app data and having full back up as well, some apps just can't be restored hence I lost most of the app data (scores and achievements) in those apps. Oh well at least I have the screenshots. LOL

  • jamaall

    I'm getting the moto x over the droids because of this

  • http://www.thepcwizard.in/ Rohan Makkar

    Google adds a great feature still remains quite. If Apple had done such a thing, it would be there most innovative feature and they would have degrade other OSs for implementing this first.

  • Dart

    Wow. With all these improvements in Android 4.3, CM10.2 should be awesome even on my old B&N Nook Color.

    I'm typing this on it right now running CM10.1. Good stuff.

  • Eran

    I have a question, is this relevant to Nexus 7 only or for other devices as well?

  • kamiller42

    I wonder how many that blamed nVidia and Tegra for the slow down on the original Nexus 7 will now admit their mistake.

  • Nee Austin

    Sadly, you'd look on forums/blog posts about this very obvious problem, and Android fanboy on fanboy violence ensued, as if we were just making it up, and because they didn't have it then it wasn't real.

    Personally I knew it was storage related because CPU% would be low but IOWAIT would hit the roof. When it was having issues, updating apps would make the N7 100% unusable and it took forever to complete.

    4.3 seems great so far. I think some manager at Google should lose their bonus and food privileges for letting us suffer this long without addressing an obvious serious problem.

  • mldi

    "Android 4.3 comes with a little-hyped feature that could be huge for performance in the future – TRIM support via fstrim."

    I would call it "over-hyped". I don't know about any of you, but 4.3 pretty much killed my N7 2012. It's just a slow disk. There's only so much you can do for that, and combining that with the low memory bandwidth, the result is a frustrating experience, trim or not.

    • Michael Pahl

      Give it more than 12 hours???
      Or ROM that SOB, your call.

  • flh3

    I've installed 4.3 on my G nex but it's still laggy. How do you run fstrim or does it do this automatically?

  • B.J. Hutto

    Does this fix the need to keep ~5 GBs of memory clear?

    • Daniel

      I would presume it does. Because this was done so that the controller always has enough free blocks to write to.

  • Vedant Lath

    Looking into this further, I've figured out that TRIM will run only if the following are true:
    - Screen has been off for more than 71 minutes
    - Battery charge level is more than 80% (if not charging) or more than 20% (if plugged in)

    Source: https://android.googlesource.com/platform/frameworks/base/+/android-4.3_r2.1/services/java/com/android/server/IdleMaintenanceService.java

  • Keaundre Dawn

    I have a Nexus 4 & I have an music player called PowerAmp. Now that I updated my phone today it closes my app everytime I turn the screen off. Its not the task killer cause its on ignore list. Please help!

  • Kai

    I really hope this is the case, my N7 is so slow now that I feel embarrassed to bring it outside the house.

  • mgamerz

    old news AP... this has been known for a while now.
    edit: Thanks for saying this was a new story FB.