You wrote a C application that takes 20 seconds using your desktop processor. An improved C compiler is released that requires only 0.5 as many instructions as the old compiler. The CPI however increased by 1.3. How fast will the application run when compiled with the new compiler?
CPU time is given by
CPU time = Instruction count x CPI x clock cycle time
CPU time = Instruction count x CPI / clock rate
where CPI means cycles per instruction
Compiler performance will only be depended by Instruction count and CPI.
Assume compiler A needed x instruction, so compiler B will take x/2 instruction.
(CPI)A = z (CPI)B = z*(1.3/100)
clock cycle will be equal for both compilers = y
(CPUTime)A = (Instruction count)A * (CPI)A * (Clock cycle Time)A = (x)*(z)*(y) = 20 sec
(CPUTime)B = (Instruction count)B * (CPI)B * (Clock cycle Time)B = (x/2)*(z*(1.3/100))*(y) = (x)*(y) *(z)(1.3/200)=(20)*(1.3/200)= 0.13 sec
It will run in 130 millisecond
Get Answers For Free
Most questions answered within 1 hours.