Lite / Independent Engineering Research / 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?
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.
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?
- Mean
- Median
- 99th-percentile or worst case
- The fastest run
Guess first, then reveal
A deadline is about the tail. The mean (2.1 ms) hides 10 missed deadlines in 1,000 loops. Report percentiles (p50, p99, max) for latency-critical systems.
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.
What the interactive shows (text version)
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.
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
Intuitive
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.
Technical
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.
Mathematical
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.
Applied
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.
Practice
Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.
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.
Reflect
What would a sceptical reviewer ask about the last performance claim you made?
Write your answer on paper or in your own notes. Lite never stores what you write.