1 while (t < threshold) { 2 t = 0; 3 for(i = 0; i < N; i++) 4 t += A[i] + B[i] * delta; 5 delta -= 0.1 * t; 6 } 1 for (i = 0; i < N; i++) 2 a += A[i]; b += B[i]; 3 while (t < threshold) { 4 t = a + b * delta; 5 delta -= 0.1 * t; 6 } Listing 1: An example code (on the left) with temporal inefficiencies that cannot be identified by existing fine-grained profilers. Because arrays A and B are immutable in the loop nest, computing on these loop invariants introduces many redundancies. One can hoist the redundant computation outside of the loop (on the right) for optimization. 1 int A[N] = {1, 1, 1, 15}; 2 for(i = 0; i < N; i++) 3 { 4 t += func(A[i]); 5 } 1 int A[N] = {1, 1, 1, 15}; 2 a = func(A[0]); 3 for(i = 0; i < N; i++) { 4 if (A[i] != A[i-1]) 5 a = func(A[i]); 6 t += a; }
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. CCS CONCEPTS• General and reference → Metrics; Performance; • Software and its engineering → Software maintenance tools. 142 for ( int bit = 0, dual = 1; bit < logn ; bit ++ , dual *= 2) { 143 ... 144 for ( int a = 1; a < dual ; a ++) { 145 ... 146 for ( int b = 0; b < n; b += 2* dual ) { 147 int i = 2* b ; 148 int j = 2*( b + dual ); 149 double z1_real = data [j ]; 150 double z1_imag = data [j +1]; 151 double wd_real = w_real * z1_real -w_imag * z1_imag ; 152 double wd_imag = w_real * z1_imag + w_imag * z1_real ; 153 ▶ data [j] = data [i] -wd_real ; 154 data [j +1] = data [i +1] -wd_imag ; 155 ▶ data [i] += wd_real ; 156 data [i +1] += wd_imag ; 157 }}} Listing 1: Redundant memory loads in SPECjvm 2008 scimark.fft. data[i]is loaded from memory twice in a single iteration whereas it is unmodified between these two loads.
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.
customersupport@researchsolutions.com
10624 S. Eastern Ave., Ste. A-614
Henderson, NV 89052, USA
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Copyright © 2024 scite LLC. All rights reserved.
Made with 💙 for researchers
Part of the Research Solutions Family.