1 in fact the actual speedup was higher due to

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ) { int i; for (i = 0; i < n; i++) dest[i] = src[i]; } Suppose a is an array of length 1000 initialized so that each element a[ ] equals . A. What would be the effect of the call copy_array(a+1,a,999)? B. What would be the effect of the call copy_array(a,a+1,999)? C. Our performance measurements indicate that the call of part A has a CPE of 3.00, while the call of part B has a CPE of 5.00. To what factor do you attribute this performance difference? D. What performance would you expect for the call copy_array(a,a,999)? 5.14 Life in the Real World: Performance Improvement Techniques Although we have only considered a limited set of applications, we can draw important lessons on how to write efficient code. We have described a number of basic strategies for optimizing program performance: 1. High-level design. Choose appropriate algorithms and data structures for the problem at hand. Be especially vigilant to avoid algorithms or coding techniques that yield asymptotically poor performance. 2. Basic coding principles. Avoid optimization blockers so that a c...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online