Performance Analysis

Measuring per-element time for repeatedly reading an array while gradually growing its size shows time rising in steps at certain sizes. Why?

  1. AThe CPU frequency always drops as arrays grow
  2. BEach time the array exceeds L1, L2 and then L3 cache capacity, data must come from slower storage
  3. CThe results of additions change with array size
Show answer and explanation

Answer: B. Each time the array exceeds L1, L2 and then L3 cache capacity, data must come from slower storage

While small, the array fits in L1 cache and reads fast; once it exceeds L1 it comes from L2, and beyond L2 or L3 from main memory, with per-element time stepping up each time. This method roughly reveals cache capacities and their speeds. It also shows why keeping the data a program repeatedly uses (its working set) within cache has such a large effect on performance.

  • A. Frequency is not set by array size.
  • B. Correct. The memory hierarchy's capacities show up as steps.
  • C. Computation results do not change.
Practice this topic Back to topic

More Performance Analysis questions

  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?