A benchmark produces observations
Running the same workload repeatedly can produce different durations. Scheduling, cache state, background activity, and other conditions may vary. A summary is a way to describe those observations, not a replacement for understanding what was measured. Start by preserving the raw values and their units.
The mean adds the values and divides by their count. The median describes the middle of the sorted values, averaging the two middle values when the count is even. NIST’s measures of location explains why alternative notions of a typical value can be useful. Their behavior differs when a distribution has a long tail or unusual observations.
Work through a small example
Consider five illustrative durations: ten, ten, eleven, twelve, and fifty-seven milliseconds. Their sum is one hundred milliseconds, so their mean is twenty milliseconds. Their median is eleven milliseconds. Both calculations are correct. They highlight different features of the same dataset.
The median captures the middle observation and is less affected by the largest value. The mean includes the cost of that large value. If fifty-seven milliseconds represents a real user request, hiding it would conceal part of the experience. If it came from an unrelated instrumentation error, document that finding instead of simply deleting it because it is slow.
Now imagine another method consistently takes fourteen milliseconds on the same illustrative task. The first method looks better by median but worse by mean in this tiny example. A decision requires knowing whether typical duration, total time, or occasional delay matters most. These invented values demonstrate arithmetic; they are not measured performance results.
Percentiles describe a distribution’s position
A percentile identifies a position within ordered observations. A p95 latency is intended to describe a duration at or below which roughly ninety-five percent of the observed distribution falls, according to a stated calculation convention. With only a few samples, a high percentile is poorly supported and may depend strongly on the interpolation method.
Python’s statistics reference documents means, medians, quantiles, and measures of spread. Record the estimator or software used when a precise comparison matters. Two reports can produce slightly different quantiles from the same small sample without either having copied a value incorrectly.
Variation also matters. A method with similar central latency but highly variable completion times may be unsuitable for a predictable interactive service. A batch process may care more about aggregate completion time. Use the metric that reflects the actual requirement rather than selecting whichever statistic makes an implementation look strongest.
An uncertainty interval has assumptions
A confidence interval attempts to express sampling uncertainty about a statistic under a chosen method. Bootstrap methods construct resampled datasets and recompute the statistic. The SciPy bootstrap reference describes this process and its available interval methods. An interval does not remove bias from an unfair workload or an unrepresentative environment.
When comparing paired runs, preserve the pairing during analysis. If both methods experienced the same momentary host slowdown, their relationship contains information that would be lost by shuffling every value independently. Decide the analysis before searching through many possible summaries.
Read the conclusion at the right scale
A small estimated advantage with substantial uncertainty may not distinguish the methods reliably. A clear difference on one workload may still have little practical value if the application spends most of its time elsewhere. Statistical evidence and engineering relevance are separate questions that should meet in the final decision.
A useful report names the sample count, unit, summary, variation, raw-data location, and exclusions. It explains why the chosen statistic answers the task’s question. Continue with fair benchmarks for measurement design and latency and throughput for choosing service-level metrics.