A program you wrote is not running as fast as you wish on yo
A program you wrote is not running as fast as you wish on your intended computer. Re-writing your code is one tactic to gain speed, but you want to try a faster-to-implement approach first. Your plan is to turn on some of the numerous optimization types available in the compiler you are using. You have done some research and recognize that the best speedup may require testing a variety of combinations of optimizations, so you have written a script to automate the compiles and timing of test runs. This software framework is aimed at improving what factor(s) in the CPU Time equation and how are they improved?
Solution
Factor(s) aimed at improving in the CPU Time equation:
• Instruction Count -- The number of instructions the CPU executes
• Cycles per instructions -- The ratio of cycles for execution to the number of instructions executed.
• Cycle time -- The length of a clock cycle in seconds
Now,
Latency = Instructions * Cycles/Instruction * Seconds/Cycle
L = IC * CPI * CT
IC = Instruction Count
CPI = Cycles Per Instruction
CT = Cycle Time
Several ways to improve performance :
• Reduce CT (increase clock rate)
• Reduce IC
• Reduce CPI
*These values are for Intel’s Nehalem processor
| Instruction Type | Cycles |
| Integer +, -, |, &, branches | 1 |
| Integer multiply | 3-5 |
| integer divide | 11-100 |
| Floating point +, -, *, etc. | 3-5 |
| Floating point /, sqrt | 7-27 |
| Loads and Stores | 1-100s |
