Performance Analysis
What is the purpose of using a profiler when improving program performance?
- ATo find grammar errors in the program
- BTo count the program's users
- CTo find which functions or parts of a program consume most of the execution time
Show answer and explanation
Answer: C. To find which functions or parts of a program consume most of the execution time
In many programs most execution time is spent in a tiny fraction of the code, but human guesses about where the slowness lies are often wrong. A profiler measures and displays time and call counts per function, and even per line or instruction. As Amdahl's law implies, improving the parts that take the most time is most effective, so measuring is the first step in performance improvement.
- A. The compiler finds grammar errors.
- B. It has nothing to do with user counts.
- C. Correct. It shows where improvement should go.