Your Equation

Library / Computer / CMP-03

Computer

Average memory access time

Typical delay per memory access with a cache in front.

Ref
CMP-03
Rev
v1
Field
Computer
Result
tavg [ns]

thit the time for a cache hit, m the miss probability (fraction of accesses that miss) and tpenalty the extra time on a miss. One cache level.

Most memory accesses hit the fast cache, but a few miss and must wait for slow main memory. The average time is the hit time plus the miss rate times the extra penalty.

Calculator

Solve for
ns
ns
0.35
%
0.130
ns
20300
  • Penalty share of average time83.33 %
  • Slow-down against all hits6 ×

What drives the result

Each variable is moved across its typical range while the others stay at the values above. The longest bar is the key driver.

Average access time (ns) current value 6 ns
mMiss rateKey driver
1.131
tpenaltyMiss penalty
216
thitHit time
5.310
  • A small miss rate still dominates: at 5% misses and a 100 ns penalty, the penalty adds five times the hit time.
  • Lowering the miss rate (larger cache, better locality) usually pays more than speeding up the hit.
  • Multi-level caches apply the formula recursively: the miss penalty of L1 is the average time of L2.
Chart data as tables

Ranked variables

VariableTypical rangeLowest resultHighest resultSwing (ns)Local stepChange in result
m Miss rate0.1 to 30 %1.13129.9+10%+8.33 %
tpenalty Miss penalty20 to 300 ns21614+10%+8.33 %
thit Hit time0.3 to 5 ns5.3104.7+10%+1.67 %

Sweep of Miss rate

Miss rate (%)Average access time (ns)
0.11.1
3.8374.838
7.5758.575
11.3112.31
15.0516.05
18.7919.79
22.5223.52
26.2627.26
3031

Sweep one variable

Average access time (ns)Hover, touch, or use the arrow keys on the chart
051015202530 51015202530 Miss rate (%) now 6

Variables and how each one contributes

tavg

Average access time

Result · ns

What the equation gives you. Everything else feeds it.

thit

Hit time

ns · typical 0.3 to 5

Time for an access that hits the cache. Adds directly.

m

Miss rate

% · typical 0.1 to 30

Percentage of accesses that miss the cache. A strong driver: each extra percent adds tpenalty/100.

tpenalty

Miss penalty

ns · typical 20 to 300

Extra time to fetch from the next level. Scales with the miss rate.

Worked example with the values above

  1. Convert the miss rate: 5% = 0.05.
  2. Penalty contribution: 0.05 × 100 ns = 5 ns.
  3. Average time = 1 + 5 = 6 ns.

Assumptions and limits

  • One cache level, constant miss penalty.
  • Miss rate and penalty measured for the same workload.
  • Same time units for both delays.

Common mistakes

  • Entering the miss rate as a fraction when a percentage is expected.
  • Counting hit time again inside the penalty.
  • Ignoring the miss rate varies between programs.

Statistics and uncertainty

Miss rate is measured with a profiler and varies by program and phase. A ±20% error in miss rate becomes about ±17% in average time when the penalty share is 83%.

Where it is used

  • Choosing cache size and memory technology.
  • Estimating real-time deadlines in embedded systems.
  • Tuning data layouts for speed.

Maths you need

  • Probability: miss rate is the chance of a miss
  • Averages: weighted by probability

Related formulas

Practise this formula