一句话:提出 JXPerf,用硬件性能监控单元与调试寄存器轻量定位 Java 程序中的浪费性内存操作。
许多性能低效——如算法/数据结构选择不当、开发者忽视性能、错失的编译器优化——会表现为浪费性内存操作,即本可避免的向内存产生或从内存消费数据。传统字节码插桩分析此类问题开销过高,且无法发现机器码生成中的低效。JXPerf 用硬件性能监控单元采样访问的内存位置,并用硬件调试寄存器监视对同一内存的后续访问,在机器码级别轻量测量,并将低效归因到完整调用上下文。其运行时与内存开销均约 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 the 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.
DOI 原文 ·
@inproceedings{paperbot5150,
title = {Pinpointing performance inefficiencies in Java},
author = {Pengfei Su and Qingsen Wang and Milind Chabbi and Xu Liu},
booktitle = {FSE},
year = {2019},
doi = {10.1145/3338906.3338923}
}