How 7 iOS Apps Could Save You 500MB of Storage

Noah Martin
Jan 14 · 6 min read
Image for post
Image for post
Breakdown of the Spark app, red indicates duplicates

Background

Sometimes it’s a quick feature release with an uncompressed image that adds 5%. Sometimes it’s a slow, steady increase of 0.5% each week.

I worked on these issues as a software engineer at Airbnb for 4.5 years, and in my own apps with ThnkDev. Recently, I personally analyzed over 150 apps to try to solve the issue of app size once and for all. I wanted to share my findings about common mistakes with everyone so we can all build lighter and faster apps! 🚀

Knowing exactly what goes into your app is tricky for fast moving teams, thats why automated testing and alerts around best practices makes apps more efficient. Emerge aims to do this for your apps.

Why?

Experiments indicate as much as a 0.5% drop in install conversions per megabyte added.

What is app size anyway?

Image for post
Image for post
Install and download size for Hopper

Users most often see install size. It’s on the App Store page and shown in system settings. Install size is how much storage your app takes up on a user’s phone. To keep things simple in the rest of this post when we refer to size, it’s install size, because we care most about what users see. You can read all about the different ways to measure size in the Emerge documentation.

Now let’s get started!

Image for post
Image for post
https://www.emergetools.com/apps/dropbox

Dropbox has the most savings of any app we’ve measured. Weighing in at 269 MB, our tool’s analysis shows potential size reductions of 40%. Most of this extra size is coming from duplicate localization files. As you can see from their app breakdown, each app extension has the same copy of Localizable.strings as the main app bundle, for all 21 supported languages. In addition to duplicates, the Localizable.strings files contain comments used to provide context to translators. These aren’t needed in the production app, stripping comments in production would save ~46mb. With the current setup, every new language will account for about 4mb. There are a few other things that could be improved, but let’s go on to some other apps.

Image for post
Image for post
https://www.emergetools.com/apps/spark

The Spark app is almost 10% font files. Taking a closer look at the fonts you might notice some familiar names:

  • SF-Pro-Text-Semibold.otf
  • SF-Pro-Text-Light.otf
  • SF-Pro-Text-Medium.otf
  • SF-Pro-Text-Heavy.otf
  • SF-Pro-Text-Bold.otf
  • SF-Pro-Text-Regular.otf

Each of these font files appear twice in the app, once in the main app bundle and once in the sharing extension. These are the default fonts included in iOS, and can be downloaded here. According to the license agreement shown when installing these fonts:

IMPORTANT NOTE: THE APPLE SAN FRANCISCO FONT IS TO BE USED SOLELY FOR CREATING MOCK-UPS OF USER INTERFACES TO BE USED IN SOFTWARE PRODUCTS RUNNING ON APPLE’S iOS, iPadOS, macOS OR tvOS OPERATING SYSTEMS, AS APPLICABLE.

They shouldn’t need to be included in any app targeting iOS 11+, as they can all use the default system font. Removing them would reduce Spark’s size by ~20mb.

Edit: Some have pointed out that the SF fonts change even in later iOS versions. There still may be some license agreement violations for using these, and even if they are needed it doesn’t change the total savings for Spark which is calculated assuming the duplicate copy of the font is removed and only one is kept.

Image for post
Image for post
https://www.emergetools.com/apps/ebay

The Ebay app has an interesting architecture where the main app’s executable is only ~150kb although 86% of the app size is executable files. This is because most of their app consists of frameworks, the biggest one (34mb) is EbayApp.framework. Almost 100mb of these frameworks are unnecessary swift symbols. When you build a swift framework, the binary contains a symbol table which you can read with the nm command.

nm -m eBayApp.framework/eBayApp
...
s7eBayApp28SettingsViewControllerLegacyC13viewDidAppearyySbFTo

Ebay has tens of thousands of these non-external symbols. After stripping them using the method described here the size is greatly reduced.

Image for post
Image for post
https://www.emergetools.com/apps/twitch

Just like Ebay, Twitch has a lot of size attributed to non-external swift symbols in binaries. However, Twitch also has a very large main app binary. More than half of it is the LINKEDIT segment containing the symbol table. Since this binary isn’t a dynamic framework, we can be more aggressive with symbol stripping and even remove the global symbols.

Image for post
Image for post
https://www.emergetools.com/apps/slack

Slack could also greatly benefit from stripping Swift symbols. They have almost 10mb of images, but could drop 3mb by using some image compression techniques or new files formats such as HEIC.

Image for post
Image for post
https://www.emergetools.com/apps/vrbo

Vrbo shows a new kind of breakdown, 18% of the app is debugging symbols in .bcsymbolmap files. These are basically dSYMs for bitcode, so they should not be shipped to users in the final product. Taking a closer look shows the files belong to TwilioChatClient.framework which is a binary SDK distributed here. The final step of their documentation instructs users to run a shell script that deletes all bcsymbolmap files for release builds. The documentation says this step isn’t needed to be done manually for CocoaPods integration, but we found if you don’t do this the extra 20mb of files get included in your production app.

Image for post
Image for post
https://www.emergetools.com/apps/lyft

The Lyft app has hundreds of duplicate files, the largest consumer of space is a single asset catalog copied 73 times in separate bundles. Another asset catalog that is virtually identical except for the timestamp at which it was created is copied 67 times. Each of these contain nothing but 482 colors (colors can be stored in asset catalogs to simplify management of dark mode). With each one taking ~250kb these quickly eat up 35mb.

And this brings our total to 536mb!

Wrapping Up

You can upload your first build to Emerge free to get your own build analysis. Please get in touch if you make any changes to your apps or have any suggestions or feedback!

The Startup

Medium's largest active publication, followed by +773K people. Follow to join our community.

Thanks to Josh

Noah Martin

Written by

Co-founder of Emerge, previously software engineer at Airbnb.

The Startup

Medium's largest active publication, followed by +773K people. Follow to join our community.

Noah Martin

Written by

Co-founder of Emerge, previously software engineer at Airbnb.

The Startup

Medium's largest active publication, followed by +773K people. Follow to join our community.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store