Section 18.1.13

Contrast, normalization, ratio, and percent overhead

Definition

A contrast is a stated comparison between a value measured under the condition being tested and the value under a reference condition, called the baseline: either their difference, in the measurement’s unit, or their ratio, which has no unit. Normalization divides values by a reference value, so that the reference becomes 1 and results on different scales can be compared. Percent overhead is the extra cost under the tested condition as a percentage of the baseline cost. Each of these numbers means something only when its baseline is named.

Where it fits

Main entry: Effect size (§11.24).

The effect size entry states the size of a difference in three forms: absolute, relative and standardized. This entry covers the relative forms and the words used for them. Let OO be the baseline value and NN the new value, both positive and in the same unit, such as latencies in milliseconds.

Take O=10O = 10 milliseconds and N=5N = 5 milliseconds. The absolute difference is 5−10=−55 - 10 = -5 milliseconds, the ratio is 5/10=0.55 / 10 = 0.5, the speedup is 10/5=210 / 5 = 2 and the percent change is 100×(5−10)/10=−50%100 \times (5 - 10) / 10 = -50\%. Measured against the new value instead, the old value is 100×(10−5)/5=100%100 \times (10 - 5) / 5 = 100\% larger. Both percentages are correct; they divide by different values. For an overhead, take a baseline of 40 microseconds and 46 microseconds under the tested condition. The percent overhead is 100×(46−40)/40=15%100 \times (46 - 40) / 40 = 15\%, and the normalized value is 46/40=1.1546 / 40 = 1.15.

Normalized values need care when they are averaged. Suppose system A takes 2 seconds on workload 1 and 1 second on workload 2, and system B takes 1 second and 2 seconds. Normalized to B, the ratios of A are 2/1=22 / 1 = 2 and 1/2=0.51 / 2 = 0.5, and their ordinary average is (2+0.5)/2=1.25(2 + 0.5) / 2 = 1.25: A looks 25% slower. Normalized to A, the ratios of B are 0.5 and 2, with the same average 1.25: B looks 25% slower too. The geometric mean §11.39, 2×0.5=1\sqrt{2 \times 0.5} = 1, gives the same answer in both directions: neither system is slower, because the geometric mean treats a doubling and a halving as equal and opposite.

Limits and common mistakes

A small error in a small baseline becomes a large error in the ratio. Suppose the tested condition takes 3 microseconds and the true baseline 2 microseconds, an overhead of 100×(3−2)/2=50%100 \times (3 - 2) / 2 = 50\%. If the baseline is measured 1 microsecond too short, the overhead becomes 100×(3−1)/1=200%100 \times (3 - 1) / 1 = 200\%. A baseline of 0 gives no ratio at all.

Name the denominator of every overhead. A cost of 5 microseconds is 100×5/10=50%100 \times 5 / 10 = 50\% of a 10-microsecond function, but 100×5/1000=0.5%100 \times 5 / 1000 = 0.5\% of a 1000-microsecond operation that contains that function.

Percent changes do not add. An increase of 50% followed by a decrease of 50% leaves 1.5×0.5=0.751.5 \times 0.5 = 0.75 of the starting value. A change in a quantity that is itself a percentage is stated in percentage points: a loss rate that rises from 10 to 12% rises by 2 percentage points, a relative increase of 100×2/10=20%100 \times 2 / 10 = 20\%.

Averaging the ratios of single runs and dividing two totals give different answers; the entry on the ratio of aggregates versus aggregate of ratios §11.40 explains when each one is right.

Questions answered

What does rr times smaller mean?

A writer who says that a new value is rr times smaller than an old value, for a number rr greater than 1, usually means that the new value equals the old value divided by rr, but the phrase has no agreed arithmetic meaning and should be replaced by an explicit ratio. Read literally, it would mean the old value minus rr times the old value, which is negative for any rr greater than 1. The mirror phrase is ambiguous too: some readers take “3 times larger” to mean 3 times the old value, and others the old value plus 3 times the old value, which is 4 times it.

Write instead “the new latency is 1/r1/r of the old latency” or “old divided by new is rr”. For an old latency of 10 milliseconds and r=2r = 2, the new latency is 10/2=510 / 2 = 5 milliseconds, a percent reduction of 100×(1−1/2)=50%100 \times (1 - 1/2) = 50\%. For r=10r = 10 the reduction is 100×(1−1/10)=90%100 \times (1 - 1/10) = 90\%, and for r=100r = 100 it is 99%, so equal factors of 10 look like ever smaller percentage gains. Give the absolute difference as well, here 10−5=510 - 5 = 5 milliseconds, so that the reader can judge whether the change matters.

Related entries: Ratio of aggregates versus aggregate of ratios (§11.40), Geometric mean (§11.39), Logarithmic axes and multiplicative differences (§18.1.12).