An actionable performance profiler for optimizing the order of evaluations

An actionable performance profiler for optimizing the order of evaluations
复制标题

DOI:
10.1145/3092703.3092716
复制
发表时间:
2017-07
期刊:
Proceedings of the 26th ACM SIGSOFT International Symposium on Software Testing and Analysis
影响因子:
--
通讯作者:
Marija Selakovic;Thomas Glaser;Michael Pradel
Marija Selakovic;Thomas Glaser;Michael Pradel
中科院分区:
其他
文献类型:
--
作者:
Marija Selakovic;Thomas Glaser;Michael Pradel

文献摘要

被引文献

相似文献

程序的效率往往可以通过应用相对简单的更改来提高。为了找到这样的优化机会,开发人员要么依靠手动的性能调优,这是非常耗时的,并且需要专业的知识,要么依靠传统的分析器,它显示资源花费在哪里,而不是如何优化程序。本文提出了一个提供可操作建议的分析器,它不仅可以找到优化机会,还可以建议利用这些机会的代码转换。具体来说,我们关注的是与计算子表达式的顺序相关的优化机会,这些子表达式是程序决策的一部分。为了帮助开发人员找到这种重新排序的机会,我们提供了DecisionProf,这是一种动态分析,可以自动识别逻辑表达式和switch语句中给定输入的检查的最佳顺序。关键思想是评估所有可能顺序的计算成本,找到最优顺序,并仅在重新排序产生统计上显着的性能改进时向开发人员建议代码转换。将DecisionProf应用于43个真实的JavaScript项目,揭示了52个有益的重新排序机会。按照DecisionProf的建议对代码进行优化,可以将单个函数的执行时间减少2.5%到59%,并在统计上显著提高应用程序级别的性能,提高幅度在2.5%到6.5%之间。
The efficiency of programs often can be improved by applying rel- atively simple changes. To find such optimization opportunities, developers either rely on manual performance tuning, which is time-consuming and requires expert knowledge, or on traditional profilers, which show where resources are spent but not how to optimize the program. This paper presents a profiler that provides actionable advice, by not only finding optimization opportunities but by also suggesting code transformations that exploit them. Specifically, we focus on optimization opportunities related to the order of evaluating subexpressions that are part of a decision made by the program. To help developers find such reordering opportuni- ties, we present DecisionProf, a dynamic analysis that automatically identifies the optimal order, for a given input, of checks in logical expressions and in switch statements. The key idea is to assess the computational costs of all possible orders, to find the optimal order, and to suggest a code transformation to the developer only if reordering yields a statistically significant performance improve- ment. Applying DecisionProf to 43 real-world JavaScript projects reveals 52 beneficial reordering opportunities. Optimizing the code as proposed by DecisionProf reduces the execution time of indi- vidual functions between 2.5% and 59%, and leads to statistically significant application-level performance improvements that range between 2.5% and 6.5%.