School/✦ Research Engineer/Week 26
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?
About 45 min · 3 goals · Checked by automated tests
1.Why should I care?
Performance numbers are notoriously easy to get wrong: caches warm up, clocks scale with temperature, background tasks interfere. A sound benchmark protocol is what turns 'it felt faster' into evidence a reviewer will accept.
- ◇ Write a benchmark protocol: workload, conditions, warm-up, repeats and an analysis plan.
- ◇ Choose primary and secondary metrics (latency percentiles, throughput, energy, memory, accuracy).
- ◇ Report a comparison with uncertainty and recognise multi-objective trade-offs with a Pareto view.
2.Predict
A controller's loop time is measured 1,000 times: mean 2.1 ms, but 1% of runs take 9 ms. The deadline is 5 ms. Which metric matters most?
Guess first. Being wrong here is how the surprise works.
3.Understand
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.
Explain it another way
Timing a runner once on a windy day tells you little. Time several races, same track, same conditions, alternate the runners, and report the spread.
Sources of noise: frequency scaling, thermal throttling, cache and TLB state, memory layout, interrupts, other processes. Mitigations: fixed frequency or performance governor, warm-up, pinning to cores, many repeats, interleaving, and reporting the environment.
With n paired runs and differences dᵢ, the mean difference d̄ has standard error s_d/√n. A 95% interval is roughly d̄ ± 2s_d/√n for moderate n. Speed-up ratios are better summarised with geometric means across workloads.
Industry benchmark suites (for processors, embedded ML and databases) specify the workload, the rules and what must be reported, precisely so that results from different labs can be compared.
Worked 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?
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.
Common mix-ups
- One run is enough if the computer is fast.
✓ Run-to-run variation is often several percent; repeats and intervals are essential. - The mean latency is the right summary.
✓ For deadlines and user experience, tails (p95, p99, max) matter more.
4.Discover
Open the trade-offs lab. Treat the designs as candidate system configurations. Change the weights on each criterion and see which designs stay on the Pareto front no matter what. A fair benchmark reports the whole front, not just the winner under your favourite weights.
Explorer 04 — Engineering constraints
No design wins on everything
Choosing a robot's perception and compute stack means trading cost, power and capability. Set your priorities and limits, then see which options survive and which are simply worse than another.
- Meets limits
- ✕ Violates a limit
- Pareto frontier
- Outside a limit
Limits
Priorities (weights 0–10)
Cheaper is better
Lower draw means a smaller battery or longer run time
Headroom for heavier algorithms later
Estimated task success
Illustrative figures for teaching, not measured specifications
BMicrocontroller + low-res cameraRank 1
Microcontroller reading a small low-resolution camera for colour blobs.
- Cost
- 30 CU
- Power
- 0.9 W
- Compute
- 3×
- Est. accuracy
- 52 %
✓ Meets all limits · On the frontier
Score58DSBC + cameraRank 2
Single-board computer running classical vision on a standard camera.
- Cost
- 80 CU
- Power
- 5.5 W
- Compute
- 25×
- Est. accuracy
- 74 %
✓ Meets all limits · On the frontier
Score57AMicrocontroller onlyRank 3
Microcontroller with distance and contact sensors; no camera.
- Cost
- 12 CU
- Power
- 0.3 W
- Compute
- 1×
- Est. accuracy
- 35 %
✓ Meets all limits · On the frontier
Score50CSingle-board computerRank 4
General-purpose single-board computer with the same simple sensors, no camera.
- Cost
- 55 CU
- Power
- 4.0 W
- Compute
- 25×
- Est. accuracy
- 48 %
✓ Meets all limits · Dominated by B (no worse on cost or accuracy, better on one)
Score46ESBC + camera + acceleratorExcluded
Adds a neural-network accelerator for learned object detection.
- Cost
- 150 CU
- Power
- 10.0 W
- Compute
- 120×
- Est. accuracy
- 86 %
✕ over budget by 50 CU; over power limit by 2 W · On the frontier
Score53FSBC + depth cameraExcluded
Single-board computer with a depth camera; better 3-D estimates, costly sensor.
- Cost
- 165 CU
- Power
- 7.5 W
- Compute
- 25×
- Est. accuracy
- 82 %
✕ over budget by 65 CU · Dominated by E (no worse on cost or accuracy, better on one)
Score42
State
4 of 6 options meet the limits (budget 100 CU, power 8.0 W). Highest weighted score: B, Microcontroller + low-res camera, 58 of 100, on the Pareto frontier. Frontier on cost versus accuracy: A, B, D, E.
4 of 6 options meet the limits (budget 100 CU, power 8.0 W). Highest weighted score: B, Microcontroller + low-res camera, 58 of 100, on the Pareto frontier. Frontier on cost versus accuracy: A, B, D, E.
How to read this
Each circle is a design option, placed by cost (left is better) and estimated accuracy (up is better); its area shows power. Filled circles meet every limit you set; dashed, hollow circles marked ✕ break at least one, and the hatched area shows where a limit rules options out.
The stepped line is the Pareto frontier: options for which nothing else is both cheaper (or lower-power) and more accurate. An option off the frontier is dominated, meaning another option beats it on both axes, whatever your priorities. The weighted score below is a different question: it depends entirely on the weights you chose, so two people can reasonably rank the frontier differently.
Assumptions & limitations
- All figures are illustrative teaching values chosen to make trade-offs visible. They are not measured specifications, prices or benchmarks of any product.
- Options are generic archetypes; real stacks vary widely in what each part costs, draws and achieves.
- Scores use a weighted sum of min–max normalised criteria. Normalisation is relative to these six options, so adding or removing one changes every score.
- A weighted sum hides trade-offs: a high score can come from one extreme strength. That is why the Pareto view is shown alongside it.
- The frontier is computed on the two plotted criteria only; an option dominated here may still be the best on a criterion not plotted (for example F has lower power than E).
- Accuracy is treated as a single fixed number. In practice it depends on lighting, the objects, the algorithm and integration effort, and is uncertain until tested.
Can't use the interactive? Read a description instead
The trade-offs lab scores six designs on several criteria with adjustable weights and highlights those on the Pareto front, which never change with the weights; only the single 'winner' does.
5.Checkpoint: guided practice
Check what you just discovered before going on. Hints appear after a wrong answer.
Practice 1
Why discard warm-up runs?
6.Practice on your own
Practice, not a test. Wrong answers get a hint and another try.
Practice 2
Sixteen paired runs give a mean difference of 0.8 ms with standard deviation 1.6 ms. What is the standard error of the mean difference, in ms?
Practice 3
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)?
Practice 4 · a fresh version every time
A program executes 200 million instructions with an average CPI of 1.8 on a 3 GHz processor. How long does it take, in milliseconds?
Practice 5
Which practice makes a two-system timing comparison fairest?
7.Apply it
Write the benchmark protocol for your term project: workload, systems (three precisions), conditions, warm-up, number of repeats, primary and secondary metrics, how you will compute uncertainty, and your decision rule.
8.Reflect
Concepts: Evaluation metrics · Comparing conditions with uncertainty · Reproducibility and documentation · Experimental design and test protocols