Reducing App and SDK Size With Emerge Tools

At Stream, the iOS and Android SDK teams rely on Emerge Tools’ size analysis service to analyze and monitor the binary size of our SDKs and prevent regressions in our SDK deployment size. As an integral part of our CI pipeline, Emerge Tools helps us ensure that we deliver the highest quality SDK to our customers.

Jeroen L.
Jeroen L.
Published March 18, 2022 Updated March 21, 2022
Reduce SDK and App size feature image

The Importance of Mobile App and SDK Size

When developing a mobile app, one crucial performance metric is app size. An app’s size can be difficult to accurately measure with multiple variants and device spreads. Once measured, it’s even more difficult to understand and identify what’s contributing to size bloat.

Many people think that as phone storage has increased, size is no longer important, but this is not the case. Even to this day, size matters when creating an app.

Smaller apps lead to higher install conversion rates, lower uninstall rates and faster general app performance. In fact, app size is so important that Apple has dedicated documentation explaining how to reduce your app size.

A study conducted by app analytics company Segment found that install rates dropped 66% for iOS apps that exceeded Apple’s over the air cellular download limit, currently set at 200MB.

App size study

Google has also found a strong correlation between APK size and install conversion rates, claiming that install conversion rates drop 1% for every 6MB added to APK size.

One of the biggest contributors to increasing mobile app size is third-party frameworks. As a third-party SDK, our size footprint is multiplied by all the customers who integrate with us. By reducing the size of our SDK, we reduce the size of apps that use Stream (and help the environment a bit as well).

As a leader in the mobile SDK space, our responsibility is to make sure we don’t waste unnecessary device space or degrade the app performance of our customers.

Measuring Mobile App Size

The easiest way to accurately measure the size of a mobile app is to upload the app to the App Store or Google Play. However, this is just the start. Being able to accurately measure the size in one-off situations can be quite cumbersome and is certainly not scalable if you have an app with multiple developers.

Once you can measure the overall app size (both download and install sizes), you need to be able to identify what aspects of the app are contributing to the size. When we started inspecting our SDK size, we found that there aren’t many products available that can inspect iOS and Android binaries.

Tools like Bloaty are good for deep dives by expert developers, but it still lacks many of the features our team was looking for. It was very important for us to continuously monitor our SDK size, as we don’t want to ship regressions to customers. Bloaty didn’t have a way to integrate with our CI, nor did they provide any actionable insights on how to reduce app size.

Enter Emerge Tools.

Emerge Tools’ size analysis feature was the only service that offered what we were looking for: Continuous monitoring to prevent future regressions while providing actionable insights to instantly reduce our SDK size.

How We Used Emerge Tools to Reduce SDK and App Size

Emerge has helped us reduce over 10% of our SDK size, and we didn’t need to be experts to do it. We looked at the automatic insights generated by Emerge Tools to find issues flagged by their tooling. We also inspected our binaries with the “X-Ray” feature, which gives a lot of insight on sometimes surprising effects on your binary size due to using specific language features.

Automated Insights to Reduce Size

Right from our first upload, the automated insights feature was immensely valuable to us. It is basically a list of items found by Emerge Tools that carry a significant impact on the overall size of your binary. The insight itself explains what you could do on a code level to achieve maximum impact on the overall binary size. This consistently saves hours of developer time.

The biggest surprise we ran into was the enormous price of protocol conformance. By reducing the number of protocols we define in our codebase and constraining the remaining protocols as much as possible, we were able to achieve significant impact on the binary size of our SDK.

This change helped reduce the size of our SDK by over 7%! We probably would have never accomplished this without the help of Emerge’s automated insights.

Visualizations to Easily Identify Size Bloat

Emerge also provides visualizations (like their interactive X-Ray) that show you the size of your code, from functions and types to dyld/dex metadata. The effects of protocols on our binary size allowed for some quick wins in reducing size bloat.

How Emerge Tools Helps Us Monitor SDK and App Size

Emerge Tools makes it simple to monitor and maintain your SDK and app size. Keep reading to learn how it benefits the iOS and Android teams at Stream.

Quick and Easy Integration

Integrating Emerge Tools’ size monitoring service into our CI and build process was very easy. Once we obtained an API token, we just quickly configured our GitHub Actions-based workflow as described in Emerge’s ​​GitHub Action documentation. It doesn’t require access to source code and literally took us 15 minutes to get going.

What you end up with is a solid grasp on the impact of any changes you want to apply to your sourcecode repository. Just have a look at some of our pull requests to get a feel for things:

Alerts for Size Regressions or Improvements

Emerge allows you to set thresholds on many parameters inspected by their tooling. If any threshold is breached, a build on our CI is flagged as a build warning or failure. This automated process allows us to safeguard ourselves against unexpected and unwanted degradation of our binary size metrics.

These alerts can be surfaced directly on pull requests via status checks or through Slack.

Emerge Local new

By having Emerge Tools inspect our build artifacts at key moments, we can rest assured the binary we deliver to our end users is of a size we think is acceptable considering the functionality it brings.

Reporting and Dashboard Tools

Emerge takes a unique approach to helping teams track their app size. They simplify all the underlying complexities around device variants, app thinning, etc. and provide your team with the ability to track and plan around a single number: the size users see on the App Store or Google Play Store.

They even provide a full-featured web platform with access to dashboards and reporting to track app size over time, and even provide an API if you’d prefer to ingest the metrics into your own internal dashboards.

size tracker, downward trend

Emerge Tools Can Do So Much More

At Stream, we know the immense value of app performance and we love tools that can help developers solve the complex problems around it. Emerge Tools proved to be such a useful set of tools, we just had to share our experience on our blog. Besides the things mentioned in this article, Emerge Tools can do more.

Check out the Performance Testing and Launch Booster docs to see other use cases that could benefit you and your team.

Performance tracker

I’d recommend checking Emerge Tools' other offerings as well. If they are even half as useful as the tools we discussed in this article, you should not pass on the opportunity to take a look and see for yourself what Emerge Tools can do for your codebase.