An Experience with Code-Size Optimization for Production iOS Mobile Applications
Authors:
- 27 February 2021
- conference paper
- Published by Institute of Electrical and Electronics Engineers (IEEE)
- p. 363-377
Abstract
Modern mobile application binaries are bulky for many reasons: software and its dependencies, fast-paced addition of new features, high-level language constructs, and statically linked platform libraries. Reduced application size is critical not only for the end-user experience but also for vendor's download size limitations. Moreover, download size restrictions may impact revenues for critical businesses. In this paper, we highlight some of the key reasons of code-size bloat in iOS mobile applications, specifically apps written using a mix of Swift and Objective-C. Our observation reveals that machine code sequences systematically repeat throughout the app's binary. We highlight source-code patterns and high-level language constructs that lead to an increase in the code size. We propose whole-program, fine-grained machine-code outlining as an effective optimization to constrain the code-size growth. We evaluate the effectiveness of our new optimization pipeline on the UberRider iOS app used by millions of customers daily. Our optimizations reduce the code size by 23%. The impact of our optimizations on the code size grows in magnitude over time as the code evolves. For a set of performance spans defined by the app developers, the optimizations do not statistically regress production performance. We applied the same optimizations to Uber's UberDriver and UberEats apps and gained 17% and 19% size savings, respectively.Keywords
This publication has 29 references indexed in Scilit:
- System-wide compaction and specialization of the linux kernel2005
- Finding effective compilation sequences2004
- Reducing code size with echo instructions2003
- Survey of code-size reduction methodsACM Computing Surveys, 2003
- Code Compaction of Matching Single-Entry Multiple-Exit Regions2003
- Translating Out of Static Single Assignment Form1999
- Partial redundancy elimination in SSA formACM Transactions on Programming Languages and Systems, 1999
- Code compression1997
- Constant propagation with conditional branchesACM Transactions on Programming Languages and Systems, 1991
- Global common subexpression eliminationACM SIGPLAN Notices, 1970