4 Ways to Make iOS Apps Lighter and Faster

November 6, 2015
 
Ashley Rondeau

We recently spent some time thinking about user retention here at The Farm and one of the big areas of discussion was the size of modern apps. In one of the studies we cited in our previous blog, 50% of smartphone users surveyed deleted an app because it took up too much space on their phone, and it makes sense. After all, entry-level models of iPhones come with just 16GB of total storage space, which isn’t a lot, let alone the actual usable space after iOS 9 itself (which has thankfully slimmed down since bloated iOS 8). After a few hundred images and videos, some music, and must-have apps, users don’t have much room to add as many other apps as they might want.
Now, Apple is allowing apps up to 4GB in size. 4GB! Some users would be hard pressed to install just one of these gargantuan apps. To make sure your app isn’t one that’s deleted by the small-storage masses, it behooves you to make them as light as possible. And the great part is, making them smaller in size usually means they will run faster too, which is another thing that will keep your users happy and your app on their home screen. Here are 4 ways to reduce the size of your app, so it’s both lighter and faster.

1. Take advantage of Apple’s “App Thinning” options.

iOS 9 has been a great update to app developers looking to trim the size of their apps with the introduction of App Thinning. In a nutshell, it helps you choose only the assets your users need on their specific instance of their Apple product. For example, if someone is using an iPhone 5 with a 4″ screen, they won’t have to download an app that includes assets necessary for it to run on an iPhone with a smaller or larger screen.
App Thinning also brings On-Demand Resources, which allows certain content to be downloaded on the fly as needed, and then deleted as they are done with. As assets are able to be tagged by developers for certain use cases, this allows for much lighter apps overall that stay trim all on its own. These big changes to iOS 9 can drastically reduce the size of your app, and your team should do well to incorporate these options in your next development cycle.
(Also, an additional bonus in App Thinning is Bitcode, which you can read more about here. It saves you from writing code as it automatically compiles down to any new architecture that Apple rolls out. While this might not save tons of space, it will make your life easier.)

2. Optimize all media.

If your app pushes a lot of images, video or audio, making sure each object is optimized can save space and definitely speed up your app, especially for your users with aging devices.
Images: Apple recommends using 8-bit PNGs wherever possible. Sure, sometimes you need to render something in all its 32-bit glory, but for many images (especially images that are in greyscale) shrinking their size can save a boatload of space. Also, run them through Photoshop’s “Save for Web & Devices” feature to get images to their correct size.
Audio: Compress audio to the lowest bitrates you can without sacrificing quality. If you have music for a game, sure you want it sounding great. But do the clicks and bells of your business app need to be in crisp 44.1khz? Probably not. Compress them to small AAC or MP3 files and don’t be afraid to make them mono instead of stereo. In many cases, users won’t be able to tell the difference.
Video: Most apps shouldn’t have much video in it anyway since linking to an externally hosted source just makes sense. However, if you do need to push video, make sure you compress them as .mp4s. You’ll save space without sacrificing much quality.

3. Lower the frequency of your memory allocation.

If your app doesn’t manage memory well, it’s going to feel sluggish after a few minutes of use. Combat the slowdown by making sure you reduce how often allocations are being made so your app doesn’t just create objects willy-nilly that eat up memory. Remember, every memory allocation has a performance cost so the more efficient your app is here means the quicker it performs.
Monitor your allocations by using Allocations instrument in iOS. It captures all the info you need to see not just the total allocations, but the frequency as well. Using this tool, make sure you are deferring the allocation of blocks of memory until you actually need them. Cut out needless activity, release memory at the proper times, and you’ll see a boost to your app’s overall zippiness.

4. Code in Swift.

We’ve written about Swift providing faster performance before, and it bears mentioning again. One thing to point out is that the Swift language uses ARC (Automatic Reference Counting) to track and manage your app’s memory usage. Since ARC was introduced, the compiler has been clever enough to spot when it doesn’t need to create “temporary” allocations that can slow down performance. Generally, Swift is a champ at managing memory and automatically frees up as much of it as possible without you having to factor it into development.

For more information on how Swift helps with memory allocation, check out section of the iOS Developer Library.
What tips help you create a lighter, faster app? Sound off in the comment below!

So, if you don’t know where to get started with a blueprint for your app, Rocket Farm Studios can take the pressure off.

rocket logo

I hope you enjoy reading this blog post.

If you want our team at Rocket Farm Studios to help you with your app, just book a call.