06 125 100 100 floating point 150 200 100 200 in

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: ure 5.22 shows an example of converting the procedures combine4 and combine5 to pointer code, giving procedures combine4p and combine5p, respectively. Instead of keeping pointer data fixed at the beginning of the vector, we move it with each iteration. The vector elements are then referenced by a fixed offset (between 0 and 2) of data. Most significantly, we can eliminate the iteration variable i from the procedure. To detect when the loop should terminate, we compute a pointer dend to be an upper bound on pointer data. Comparing the performance of these procedures to their array counterparts yields mixed results: Function combine4 combine4p combine5 combine5p combine5x4 combine5px4 Page 219 239 234 239 Method Accumulate in temporary Pointer version Unroll loop ¢¿ Pointer version Unroll loop ¢ Pointer version Integer + * 2.00 4.00 3.00 4.00 1.33 4.00 1.33 4.00 1.50 4.00 1.25 4.00 Floating Point + * 3.00 5.00 3.00 5.00 3.00 5.00 3.00 5.00 3.00 5.00 3.00 5.00 For most of the cases, the array and pointer versions have the exact same performance. With pointer code, the 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