How Uber Deals with Large iOS App Size

Milind Chabbi, Jin Lin, Raj Barik
22 min readadvanced
--
View Original

Overview

The article discusses how Uber addresses the challenge of large iOS app sizes, particularly for its Rider, Driver, and Eats applications. It details the strategies employed to reduce code size by leveraging advanced compiler technologies, achieving significant size reductions while maintaining performance.

What You'll Learn

1

How to reduce iOS app size using advanced compiler techniques

2

Why machine outlining can significantly decrease binary size

3

When to apply repeated machine outlining for optimal results

Prerequisites & Requirements

  • Understanding of iOS app development and compiler optimizations
  • Familiarity with LLVM and Swift compiler(optional)

Key Questions Answered

How does Uber reduce the size of its iOS applications?
Uber reduces the size of its iOS applications by implementing advanced compiler technologies, such as machine outlining, which identifies and replaces repeated instruction sequences with function calls. This approach has led to a 23% reduction in the Uber Rider app's size, while also achieving significant savings in the Driver and Eats apps.
What are the performance impacts of the new build pipeline?
The new build pipeline, which includes repeated machine outlining, has shown an average performance gain of 3.4% across various use cases. This improvement is attributed to a smaller instruction footprint and better cache utilization, despite the potential for increased instruction counts due to outlining.
What specific objectives did Uber set for reducing app size?
Uber aimed to keep the app size well below the App Store download limit, choose optimizations that deliver ongoing impact, and ensure that performance of critical use cases is not regressed. They also prioritized minimizing local build times to maintain developer productivity.
What challenges did Uber face when implementing the new pipeline?
Uber encountered challenges such as maintaining a local LLVM toolchain, ensuring interoperability between Swift and Objective-C LLVM-IR files, and managing performance regressions due to data locality issues when merging modules. They addressed these through configuration flags and new data-layout ordering.

Key Statistics & Figures

Reduction in Uber Rider app size
23%
Achieved through advanced compiler optimizations including machine outlining.
Performance gain from new pipeline
3.4%
Observed across various use cases after implementing repeated machine outlining.
Code size growth reduction
The new optimizations reduced the rate of code size growth compared to previous methods.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Compiler Technology
Llvm
Used for implementing machine outlining and optimizing the build process.
Programming Language
Swift
Primary language used for developing Uber's iOS applications.

Key Actionable Insights

1
Implement machine outlining in your iOS app development process to reduce binary size effectively.
This technique can lead to significant size savings, as demonstrated by Uber's 23% reduction in the Rider app. By applying this method, developers can keep their apps within the App Store's size limits, enhancing user accessibility.
2
Regularly evaluate and optimize your app's build pipeline for performance and size.
Adopting a new build pipeline that includes repeated machine outlining can help maintain optimal performance and reduce code size over time, as shown by Uber's ongoing improvements.
3
Monitor the impact of optimizations on both code size and performance metrics.
Uber's experience indicates that while size reductions are important, understanding how these changes affect performance is crucial for maintaining a high-quality user experience.

Common Pitfalls

1
Naively applying machine outlining can lead to suboptimal results.
Without considering the whole program's context, outlining may miss opportunities for further size reductions. A more strategic approach, such as repeated machine outlining, can yield better outcomes.

Related Concepts

Compiler Optimizations
Code Size Reduction Techniques
Ios App Development Best Practices