-
1.7 [15] Compilers can have a profound impact on the performance of an application. Assume
that for a program, compiler A results in a dynamic instruction count of 1.0E9 and has an
execution time of 1.1 s, while compiler B results in a dynamic instruction count of 1.2E9 and an
execution time of 1.5 s.
a. Find the average CPI for each program given that the processor has a clock cycle time of 1
ns.
CPI = cycles per instruction
1.1 x 10 cycles for 1.0 x 10° instructions => CPL = 1.1
1.5 X 109 cycles for 1.2 x 109 instructions => CPI = 1.25
b. Assume the compiled programs run on two different processors. If the execution times on
the two processors are the same, how much faster is the clock of the processor running
compiler A's code versus the clock of the processor running compiler B's code?
Execution time = CPI x IC x Cycle Time
CPIA X ICA X CTP1 = CP1g x IC3 x CT22
CT P:/CTP2 = (CPIE x ICB)/(CPIA X ICA) = (1.25 X 1.2 x 10°)/(1.1. X 1.0 x 10°) = 1.36
Cycle time P1 = 1.36 x Cycle time P2 => P1 is 36% slower than P2