06 4186 3125 3325 2066 2125 600 900 200 400 150 400

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: only a factor of three. A second drawback of loop unrolling is that it increases the amount of object code generated. The object code for combine4 requires 63 bytes, whereas the object code with the loop unrolled by a factor of 16 238 CHAPTER 5. OPTIMIZING PROGRAM PERFORMANCE requires 142 bytes. In this case, that seems like a small price to pay for code that runs nearly twice as fast. In other cases, however, the optimum position in this time-space tradeoff is not so clear. 5.9 Converting to Pointer Code Before proceeding further, let us attempt one more transformation that can sometimes improve program performance, at the expense of program readability. One of the unique features of C is the ability to create and reference pointers to arbitrary program objects. Pointer arithmetic, in fact, has a close connection to array referencing. The combination of pointer arithmetic and referencing given by the expression *(a+i) is exactly equivalent to the array reference a[i]. At times, we can improve the performance of a program by using pointers rather than arrays. Fig...
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