Performance Analysis

Learn performance analysis with multiple-choice questions: execution time = instruction count × CPI × cycle time, Amdahl's law calculations, benchmarking pitfalls, performance counters and identifying bottlenecks.

—Your accuracy
0 / 50Questions answered
Practice this topicAll questions in this topic, in random order Weak questionsRetry only the questions you last got wrong

Performance Analysis: key points

A program's speed is the product of the number of instructions executed, the average cycles per instruction (CPI) and the cycle time. Improving one factor does not make the program faster if another gets worse. Amdahl's law adds that speeding up only part of a program leaves the rest to cap the overall speedup.

Comparing performance correctly requires care in choosing benchmarks, measuring them and averaging results. This topic covers ways to isolate bottlenecks, such as counting cache misses and branch mispredictions with CPU performance counters and using the roofline model to tell whether computation or memory is the limit.

All Performance Analysis questions (50)

  1. Which is the basic formula for a program's CPU execution time?
  2. A program executing 1 billion instructions runs on a CPU with average CPI 2 and clock frequency 2 GHz. What is the execution time?
  3. A CPU design change raises clock frequency 1.5× but also raises CPI 1.2× (instruction count unchanged). How many times faster is execution?
  4. A new compiler optimization reduces executed instructions by 20% but increases average CPI by 10% (frequency unchanged). What is its effect?
  5. A program's instruction mix is 50% integer ALU (CPI 1), 30% loads and stores (CPI 2) and 20% branches (CPI 5). What is the average CPI?
  6. When comparing CPU performance by instructions executed per second (millions of instructions per second), what should be kept in mind?
  7. How is speedup, which expresses a performance improvement, calculated?
  8. A part taking 50% of total time is made 4× faster. What is the overall speedup (Amdahl's law)?
  9. You want to make an entire task 2× faster by speeding up only the part that takes 60% of the time. How many times faster must that part become?
  10. Which lesson about how to approach performance improvement follows best from Amdahl's law?
  11. What idea does Gustafson's law express?
  12. What is the difference between strong scaling and weak scaling in evaluating parallel computing?
  13. What is the most appropriate approach when evaluating computer performance with benchmarks?
  14. Which describes a standard benchmark such as SPEC CPU?
  15. When combining ratios of speed against a reference machine across several benchmarks, why is the geometric mean often used?
  16. Two programs with equal instruction counts run back to back, one at 1000 million instructions per second and the other at 500 million. What is the overall average rate?
  17. Timing a small loop like the one above gave nearly zero time even for large N. What is the most likely cause?
  18. When timing a program, why are measurements often repeated with the first few runs discarded?
  19. What is the problem with timing a very short operation once, and what is the fix?
  20. What is the difference between wall-clock time and CPU time?
  21. Which correctly describes throughput and latency as server performance measures?
  22. When evaluating web service response times, why is the 99th percentile (the boundary of the slowest 1%) often examined in addition to the mean?
  23. A server receives 100 requests per second, each taking 0.2 seconds on average (steady state). How many requests are in progress at once on average (Little's law)?
  24. What happens to request waiting time as server utilization (fraction of busy time) approaches 100%?
  25. What is the purpose of using a profiler when improving program performance?
  26. What characterizes a sampling profiler?
  27. Which statement about instrumentation profilers, which insert timing code at function entries and exits, is correct?
  28. In program performance analysis, what is a hotspot?
  29. How is a flame graph, used to present profiling results, read?
  30. Which is an example of what CPU performance counters (the PMU) can count?
  31. Performance counters show a program's IPC is very low at 0.3, with many last-level cache misses. Which pairs the likely situation with a remedy?
  32. Performance counters reveal very frequent branch mispredictions. Which is a suitable remedy?
  33. In top-down microarchitecture analysis using performance counters, which are the major categories into which CPU issue slots are divided?
  34. A program is slow, yet CPU utilization is only about 20%. What is the most likely cause?
  35. To check whether a program is compute-bound or memory-bound, its run time is measured at different CPU frequencies. What is the typical result if it is memory-bound?
  36. When the Roofline model shows a workload in the memory-bandwidth-limited region, which direction improves performance?
  37. What does the STREAM benchmark mainly measure?
  38. What is the most appropriate method for examining a parallel program's scalability?
  39. Running in parallel on 8 cores is 6× faster than on 1 core. What is the parallel efficiency?
  40. What is the phenomenon called in which adding a mechanism to measure performance changes the behavior of the program being measured?
  41. What is the most appropriate way to proceed when improving program performance?
  42. In a program processing large amounts of data, which improvement is most likely to give the largest speedup?
  43. In software development, what is the purpose of automatically running benchmarks and recording results on every change?
  44. Benchmarks on a laptop vary widely between runs of the same program. Which pairs a CPU-side cause with a countermeasure correctly?
  45. When measuring performance on multicore or NUMA systems, why are threads sometimes pinned to specific cores (setting affinity)?
  46. When analyzing the performance of a GPU program, what is the most appropriate thing to check first?
  47. When choosing servers for a data center, which is NOT a consideration beyond peak performance?
  48. When evaluating a claim that "the new method is 100× faster," what is most important to check?
  49. Why is SSD performance often stated not only as sequential read bandwidth (MB/s) but also as 4 KB random-read IOPS (I/O operations per second)?
  50. Measuring per-element time for repeatedly reading an array while gradually growing its size shows time rising in steps at certain sizes. Why?

Other topics in Computer systems