Java中的性能缺陷
Pinpointing Performance Inefficiencies in Java
摘要:
许多性能低下的问题,如算法或数据结构的选择不当,开发人员对性能的不重视,以及错过编译器优化,都表现为浪费内存的操作。浪费内存操作是那些产生/消耗可能已经避免的去往/来自内存的数据的操作。我们提出,JXPerf,一个轻量级的性能分析工具,用于精确定位Java程序中浪费内存的操作。用于这种分析的传统字节码插装(instrumentation)(1)引入了过高的开销,并且(2)错过了机器码生成中的低效率。JXPerf克服了这两个问题。JXPerf使用硬件性能监视单元来对程序访问的内存位置进行采样,并使用硬件调试寄存器来监视对同一内存的后续访问。其结果是在机器代码级别上的轻量级测量,将效率低下归因于它们的出处:完整调用上下文中的机器和源代码。JXPerf只引入了7%的运行时开销和7%的内存开销,这使得它在生产中非常有用。在JXPerf的指导下,我们通过改进代码生成和选择优秀的数据结构和算法来优化几个Java应用程序,从而产生显著的加速比。
英文摘要:
Many performance inefficiencies such as inappropriate choice of algorithms or data structures, developers' inattention to performance, and missed compiler optimizations show up as wasteful memory operations. Wasteful memory operations are those that produce/consume data to/from memory that may have been avoided. We present, JXPerf, a lightweight performance analysis tool for pinpointing wasteful memory operations in Java programs. Traditional byte-code instrumentation for such analysis (1) introduces prohibitive overheads and (2) misses inefficiencies in machine code generation. JXPerf overcomes both of these problems. JXPerf uses hardware performance monitoring units to sample memory locations accessed by a program and uses hardware debug registers to monitor subsequent accesses to the same memory. The result is a lightweight measurement at machine-code level with attribution of inefficiencies to their provenance: machine and source code within full calling contexts. JXPerf introduces only 7% runtime overhead and 7% memory overhead making it useful in production. Guided by JXPerf, we optimize several Java applications by improving code generation and choosing superior data structures and algorithms, which yield significant speedups.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。