TactivergeLite

Lite / Textbooks / Computer Architecture / Chapter 8

8. Measuring performance honestly

Version 1 · Technically checked (automated checks only) · 4 source lessons · Full interactive version

Introduction

Architecture claims live or die on measurements, and measurements of computers are easy to get wrong. Caches warm up, clocks throttle, background tasks interfere and one lucky run looks like a breakthrough. This chapter designs benchmarks you can trust: warm-up, interleaving and repeats, a speed-up reported as a ratio with an interval, baselines and ablations, and a comparison designed around a question rather than a favourite result.

Figure 8.1. A speed-up with its uncertainty (described in words)

A speed-up of 1.2, from 120 ms to 100 ms, drawn on a number line with an approximate 95 % interval from 1.115 to 1.285. Relative standard errors of 2 % and 3 % combine to about 3.6 % of the ratio. The whole interval lies above 1, so the improvement is supported.

Explanation

Built from 4 School lessons. Each part is the lesson's own explanation.

8.1 Designing a benchmark you can trust

The new version is 1.6× faster. Or the first runs were cold, the laptop was heating up and the test file was smaller. Which?

Decide before you measure

Write down the metric (median wall time per run? energy per job?), the workload (input files, sizes), the baseline (current release, built the same way), the environment (machine, power mode, other processes), the number of repeats and the decision rule ('ship if the 95% interval on speed-up is above 1.1'). Deciding afterwards invites choosing whatever looks best.

Warm-up and steady state

First runs pay for empty caches, page faults, JIT compilation and frequency ramp-up. Unless cold-start performance is what you care about (an app's launch time), discard a few warm-up runs and report steady-state. If it is what you care about, measure it deliberately with a fresh process each time.

Repeats and variance

Timing noise comes from interrupts, scheduling, thermal throttling and memory layout. Repeat enough to make the standard error small compared with the effect you care about, and report spread, not just the mean. Medians and percentiles are robust to occasional slow runs; say which you use.

Fair comparison

Same input, same build flags, same machine, same conditions. Interleave versions (A, B, A, B…) or randomise their order so slow drift affects both equally. Pin CPU frequency if you can, close other programs, and note what you couldn't control. A fair benchmark is one where the only systematic difference is the change under test.

Common mix-ups

Open the Lite lesson: Designing a benchmark you can trust

8.2 A speed-up is a ratio: give it an interval

1.29× faster. Plus or minus what? And is 1.0 inside the interval?

From two means to one ratio

Speed-up S = t_A/t_B. With independent standard errors SE_A and SE_B: δS/S = √((SE_A/t_A)² + (SE_B/t_B)²). A 95% interval is S ± 1.96·δS. If the interval lies wholly above 1, B is faster at that confidence; if it includes 1, the data don't show a speed-up.

Compare against what matters

Statistical clarity is not the same as practical value. An interval of 1.02–1.04 is confidently above 1 but may not justify a risky change. Compare the interval with the threshold you set in your decision rule (say 1.10), not just with 1.

Ratios of noisy numbers misbehave

The quotient rule is first order. If B's relative uncertainty exceeds about 10%, the distribution of t_A/t_B is skewed and the symmetric interval misleads; use more repeats, or resample (bootstrap) the runs. Also beware averaging per-run speed-ups: the mean of ratios is not the ratio of means.

Report completely

A good line in a results table: 'Speed-up (median time, B vs A) 1.29 [1.24, 1.35], 95% CI by quotient propagation; n = 30 runs each after 3 warm-up, interleaved; same 4 MB input; laptop on mains, fixed performance mode.' Anyone can judge it, and anyone can try to reproduce it.

Common mix-ups

Open the Lite lesson: A speed-up is a ratio: give it an interval

8.3 Benchmarking computer systems fairly

Your new code is '30% faster' on your laptop. Run it again and it's 5% slower. Which number goes in the report?

Protocol first

Fix the workload (inputs, sizes, a standard suite if one exists), the system (hardware, OS, compiler and flags, versions), conditions (power mode, temperature, background load) and the procedure: warm-up runs discarded, N timed repeats, randomised or interleaved order between the systems being compared. Write it down before running, as in Term 2's pre-registration.

Metrics

Primary metric: the one your claim rests on, chosen in advance (for example p99 latency). Secondary: throughput, energy per task, peak memory, accuracy. For distributions, report median and tail percentiles, not just the mean. Use execution time, not MIPS or GHz, as the Iron Law warns.

Uncertainty and comparison

Repeat runs vary. Report the spread (standard deviation or interquartile range) and a confidence interval for the difference between systems, from paired or interleaved runs. A 3% gain with a ±5% interval is not a demonstrated gain.

Trade-offs

Many systems win on one metric and lose on another: faster but hungrier, smaller but less accurate. A design is Pareto-optimal if nothing beats it on every metric at once. Show the front and say which point your requirement selects.

Common mix-ups

Open the Lite lesson: Benchmarking computer systems fairly

8.4 Designing an architecture comparison

Ripple-carry or carry-lookahead: which adder is 'better'? The honest answer starts with 'better at what, and how will we know?'

A measurable question

Replace 'which is better?' with something like: 'How does worst-case delay and gate count grow with width n for ripple-carry and carry-lookahead adders, for n = 4 to 32?' The question names the systems, the metrics, the conditions and the range.

Theory first

Write what you expect, with reasons: ripple delay ≈ 2n gate delays (Θ(n)); lookahead ≈ c·log₂ n (Θ(log n)) with more gates. A prediction made before measuring turns the experiment into a test. If the data disagree, that is a finding to explain, not a failure.

Fair comparison

Same gate library and delay model, same widths, same test inputs (including worst-case carry chains), equal effort on each design. Measure a range of sizes so the growth rate is visible; a single size can hide a crossover where the 'worse' design wins for small n.

Common mix-ups

Open the Lite lesson: Designing an architecture comparison

Worked examples

Designing a benchmark you can trust: example 1

Blocked order: A runs first for 13 runs, then B for 13. The machine slows by 0.12 ms per run. Estimate the bias in B's mean.

Solution

A's runs occur on average at position 6.5, B's at 19.5: 13 positions later. Bias ≈ 13 × 0.12 = 1.56 ms added to B, making B look slower than it is. Interleaving would cut this to about 0.06 ms.

A speed-up is a ratio: give it an interval: example 1

A = 60.0 ± 1.2 ms, B = 50.0 ± 1.5 ms. Speed-up, uncertainty and 95% interval. Does it clear a 1.10 threshold?

Solution

S = 1.200. Relative: 2.0% and 3.0%, combined 3.6%. δS = 0.043. 95%: 1.200 ± 0.085 → 1.115 to 1.285. It clears 1.10, narrowly.

Benchmarking computer systems fairly: example 1

Ten paired runs of old vs new code give time differences (old − new) with mean 1.2 ms and standard deviation 2.0 ms. Is the new code faster?

Solution

SE = 2.0/√10 ≈ 0.63 ms. 95% CI ≈ 1.2 ± 1.3 ms = (−0.1, 2.5) ms. It includes 0: not demonstrated. Run more pairs or reduce noise.

Designing an architecture comparison: example 1

Write a decision rule for the term project before measuring.

Solution

Example: 'Choose the smallest precision whose mean absolute error over the 200 held-out test signals is below 0.5% of full scale, with the upper end of its 95% interval also below 0.5%. If none qualifies, report float.'

Interactive figures, in words

Figure 8.2 from Designing a benchmark you can trust

Fix the problems one at a time and watch the speed-up and its interval after each: same input, then interleaved order, then 3 warm-up runs, then 30 repeats. Which fix moved the estimate most? Which narrowed the interval most? Re-run with new seeds to see the interval jitter.

The checker simulates per-run times for a baseline A (true 40 ms) and version B (true 31 ms on the same input, 24 ms on a smaller one), with cold-start penalties on the first three runs of each version, a slow upward drift over the session, and random noise. It plots runs in order and reports each mean with a 95% interval, the speed-up with its interval, and a checklist: warm-up of at least 3 runs, at least 10 repeats, interleaved order and the same input. Fixing all four gives speed-ups close to the true 1.29.

Figure 8.3 from A speed-up is a ratio: give it an interval

Choose A ÷ B. Set A = 40 with δA = 0.4 (1%) and B = 16 with δB = 0.3 (about 1.9%): the same relative uncertainties as the benchmark below, so the ratio's relative uncertainty is the same too. Read it off, then increase δB and watch it grow. Finally open the benchmark checker and compare its interval with your hand calculation.

The uncertainty calculator in quotient mode shows A ÷ B with its propagated uncertainty and a Monte Carlo histogram. For A = 40 ± 0.4 and B = 16 ± 0.3 the ratio is 2.5 with a relative uncertainty of about 2.2%, the same relative uncertainty as a 40 ± 0.4 ms against 31 ± 0.6 ms benchmark, and the simulation agrees with the formula. Raising δB widens the histogram and eventually skews it, which is when the symmetric formula becomes unreliable.

The interactive versions are in the full chapter.

Laboratory

These run in a browser on the full site (they need a faster connection). Simulations are simplified educational models.

Practice

Each question links to its Lite lesson, where your answer is checked on our server and a wrong answer gets a hint. Answers are never sent to your device.

  1. Why discard the first few runs of a steady-state benchmark?
    Answer it in “Designing a benchmark you can trust”
  2. Why interleave runs of A and B rather than running all A then all B?
    Answer it in “Designing a benchmark you can trust”
  3. Which decision rule is best written before running the benchmark?
    Answer it in “Designing a benchmark you can trust”
  4. A speed-up is reported as 1.08 with 95% interval 0.97–1.19. What should the report conclude?
    Answer it in “A speed-up is a ratio: give it an interval”
  5. Why not compute the speed-up as the average of per-run ratios t_A,i / t_B,i?
    Answer it in “A speed-up is a ratio: give it an interval”
  6. Design A: 10 ms, 50 mJ. B: 12 ms, 30 mJ. C: 14 ms, 55 mJ. Which are Pareto-optimal (lower is better on both)?
    Answer it in “Benchmarking computer systems fairly”
  7. Which practice makes a two-system timing comparison fairest?
    Answer it in “Benchmarking computer systems fairly”
  8. Why measure several sizes rather than one?
    Answer it in “Designing an architecture comparison”

Engineering applications

Summarising a suite

When speed-ups across several programs are combined, the geometric mean is used for ratios. An arithmetic mean of ratios can rank two machines differently depending on which one is the reference.

Shipping an optimisation

A team adopts a compiler change only if the interval on its speed-up excludes 1 across the workloads they care about, measured on the target hardware rather than a laptop.

Watch (optional)

Streaming video uses a lot of data. Everything you need is in the text.

Summary

Glossary

Repeated trials
Repeating a measurement or test several times shows how much results vary and lets you average out random error. Field Guide
Standard error of the mean
The standard error of the mean estimates how much a sample mean would vary between repeated experiments: the sample standard deviation divided by the square root of the number of readings. Field Guide
Baselines and control conditions
A baseline is the reference condition a new idea is compared with, such as the existing design or a simple method, tested in the same way. Field Guide
Clock speed, cycles and CPI
Execution time equals the number of instructions times the average cycles per instruction (CPI) divided by the clock frequency. Field Guide

Project: An architecture comparison you would defend

Compare two designs in a School simulation (two adders, two cache settings or two pipeline options). Write the question and decision rule first, measure several sizes with repeats, and report speed-ups with intervals. Explain the result from first principles.

Deliverables

Write it up on paper or in your own notes. Lite never stores what you write.

References

← 7. Energy and reduced precisionContents →