正在加载图片...
General Optimization Techniques Loop unrolling The overhead of the loop control code can be reduced by executing more than one iteration in the body of the loop. E. g double picosy Math. PI Math cos (y)i for(int 0; i< x length i++) 1 piCOs double picosy Math PI Math cos(y) for (int i =0;i length; i + 2)t x[i]大= piCOS A efficient“+1” In array x[i+1]大= piCOs; indexing is required Fa|2011 Advanced Compiler techniques10 Fall 2011 “Advanced Compiler Techniques” General Optimization Techniques ◼ Loop unrolling ◼ The overhead of the loop control code can be reduced by executing more than one iteration in the body of the loop. E.g. double picosy = Math.PI * Math.cos(y); for (int i = 0; i < x.length; i++) x[i] *= picosy; double picosy = Math.PI * Math.cos(y); for (int i = 0; i < x.length; i += 2) { x[i] *= picosy; x[i+1] *= picosy; } A efficient “+1” in array indexing is required
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有