Performance Analysis
Which lesson about how to approach performance improvement follows best from Amdahl's law?
- APrioritize speeding up the parts that take most of the time (the common case)
- BSpeed up rarely executed parts first
- CSpeeding up any part has the same effect on the whole
Show answer and explanation
Answer: A. Prioritize speeding up the parts that take most of the time (the common case)
Making a part that uses 1% of the time infinitely fast speeds up the whole by only about 1%. Doubling the speed of a part that uses 80% yields about 1.7× overall. So the basic approach is to find where time is spent, for example with a profiler, and improve that first. "Make the common case fast" is a principle used again and again in computer design.
- A. Correct. The effect depends on the share of time.
- B. Speeding up a small share barely changes the whole.
- C. The effect varies greatly with the share.