一句话:提出全程序剖析器 LoadSpy,定位并量化冗余内存加载,指导优化并获得显著加速。
现代软件规模庞大且依赖众多外部库,冗余操作成为常见性能瓶颈。编译器受限于静态分析的歧义与作用域,难以消除算法与数据结构层面的冗余,而冗余内存加载正是这类问题的典型征兆。作者提出 LoadSpy——一个全程序剖析器,能在完全优化后的二进制上识别并量化冗余加载操作,将其关联到程序执行上下文与作用域,帮助开发者聚焦有问题的代码。LoadSpy 采用多种优化技术降低插桩开销,并提供图形界面。实验表明,即使开启最高级别编译优化,现代软件中仍普遍存在大量冗余加载;依据 LoadSpy 的指导优化多个知名基准与真实应用,可获得显著加速。
Modern software packages have become increasingly complex with millions of lines of code and references to many external libraries. Redundant operations are a common performance limiter in these code bases. Missed compiler optimization opportunities, inappropriate data structure and algorithm choices, and developers' inattention to performance are some common reasons for the existence of redundant operations. Developers mainly depend on compilers to eliminate redundant operations. However, compilers' static analysis often misses optimization opportunities due to ambiguities and limited analysis scope; automatic optimizations to algorithmic and data structural problems are out of scope. We develop LoadSpy, a whole-program profiler to pinpoint redundant memory load operations, which are often a symptom of many redundant operations. The strength of LoadSpy exists in identifying and quantifying redundant load operations in programs and associating the redundancies with program execution contexts and scopes to focus developers' attention on problematic code. LoadSpy works on fully optimized binaries, adopts various optimization techniques to reduce its overhead, and provides a rich graphic user interface, which make it a complete developer tool. Applying LoadSpy showed that a large fraction of redundant loads is common in modern software packages despite highest levels of automatic compiler optimizations. Guided by LoadSpy, we optimize several well-known benchmarks and real-world applications, yielding significant speedups.