[论文解读] Iterative compilation on mobile devices
本文提出了一种用于移动设备的迭代编译框架,利用轻量级、基于函数的捕获与重放机制,实现使用真实用户工作负载对编译器优化进行离线评估。通过仅捕获重用频繁的函数所必需的最小内存状态,该方法在最高编译器优化级别基础上实现了高达57%的性能提升,同时用户感知的性能下降平均仅为0.8%。
The abundance of poorly optimized mobile applications coupled with their increasing centrality in our digital lives make a framework for mobile app optimization an imperative. While tuning strategies for desktop and server applications have a long history, it is difficult to adapt them for use on mobile phones. Reference inputs which trigger behavior similar to a mobile application's typical are hard to construct. For many classes of applications the very concept of typical behavior is nonexistent, each user interacting with the application in very different ways. In contexts like this, optimization strategies need to evaluate their effectiveness against real user input, but doing so online runs the risk of user dissatisfaction when suboptimal optimizations are evaluated. In this paper we present an iterative compiler which employs a novel capture and replay technique in order to collect real user input and use it later to evaluate different transformations offline. The proposed mechanism identifies and stores only the set of memory pages needed to replay the most heavily used functions of the application. At idle periods, this minimal state is combined with different binaries of the application, each one build with different optimizations enabled. Replaying the targeted functions allows us to evaluate the effectiveness of each set of optimizations for the actual way the user interacts with the application. For the BEEBS benchmark suite, our approach was able to improve performance by up to 57%, while keeping the slowdown experienced by the user on average at 0.8%. By focusing only on heavily used functions, we are able to conserve storage space by between two and three orders of magnitude compared to typical capture and replay implementations.
研究动机与目标
- 解决因编译质量差且使用模式高度可变而难以优化的移动应用挑战。
- 克服在线迭代编译的局限性,避免在优化试验期间降低用户体验。
- 利用实际使用过程中收集的真实用户工作负载,实现个性化、离线的移动应用优化。
- 在保持准确评估编译转换能力的同时,最小化移动设备上的运行时和存储开销。
- 开发一种能够适应多样化移动架构和嘈杂运行时环境、且不损害用户体验的系统。
提出的方法
- 仅捕获用户交互过程中最频繁执行函数所必需的最小内存页集合,以支持重放。
- 利用现有的 Linux 内核机制(如 cgroup 内存控制)高效隔离并复制必要的运行时状态。
- 以持久化、紧凑的形式存储捕获的函数状态,与完整系统捕获相比,存储空间减少2–3个数量级。
- 使用自定义重放引擎,在相同条件下执行转换后的二进制文件,实现捕获状态的重放。
- 将重放系统与迭代编译器集成,利用空闲、充电时段在离线状态下评估多组优化。
- 对重放结果进行统计分析,以过滤掉环境波动和共调度进程带来的噪声。
实验结果
研究问题
- RQ1迭代编译能否在不降低用户体验的前提下有效应用于移动应用?
- RQ2在资源受限的移动设备上,如何高效捕获并重放真实用户工作负载?
- RQ3与完整系统捕获相比,基于函数的内存状态捕获在多大程度上可减少存储开销?
- RQ4使用重放进行离线评估能否实现与在线优化相当的性能提升,同时将用户影响降至最低?
- RQ5该系统在优化评估过程中如何处理移动环境中运行时噪声和波动性?
主要发现
- 所提出的捕获机制在用户设备上引入的平均性能开销仅为0.8%,在正常使用期间完全不可感知。
- 与 Android 编译器的最高优化级别相比,该系统在热点函数上实现了高达57%的性能提升。
- 通过仅捕获重放频繁执行函数所必需的最小状态,存储需求减少了两个至三个数量级。
- 重放机制每重放一次函数调用仅引入2.11 μs的额外延迟,确保评估结果能真实反映实际性能表现。
- 离线评估过程使得单次完整应用执行可支持多次优化试验,显著加速了最优转换组合的搜索过程。
- 重放过程中观察到的性能提升可有效映射到实际生产执行中,证实了该方法在真实世界部署中的有效性。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。