A merge-sort implementation takes 25.9 ms for 32,768 numbers. About how long will 65,536 numbers take, and why is the factor not exactly 2?
About 2.1 times as long (53.6 ms in that run). The work grows like $n \log n$, so doubling $n = 2^k$ multiplies it by $2 \cdot \frac{k+1}{k}$, here $2 \cdot \frac{16}{15} \approx 2.13$: twice the elements, plus one more level of merging.
Measured times of a Java merge-sort on random numbers, best of 10 runs per size:
| $n$ | time | ratio to the size before |
|---|---|---|
| 16,384 | 12.5 ms | |
| 32,768 | 25.9 ms | 2.1 |
| 65,536 | 53.6 ms | 2.1 |
| 131,072 | 109.0 ms | 2.0 |
| 262,144 | 224.1 ms | 2.1 |
| 524,288 | 461.1 ms | 2.1 |
The doubling test reads the growth class off these ratios: about 2 means linear, about 4 means quadratic, and "a little over 2" is the signature of $n \log n$. The excess shrinks slowly as $n$ grows ($2 \cdot \frac{19}{18} \approx 2.11$ for the step to $2^{19}$), because one more level weighs less when there are already many. A quadratic sort such as insertion-sort would show a ratio of about 4 on every line, so its times would explode where these only double.
The JVM for these measurements was started with -Xint, which switches off the just-in-time compiler. The code runs slower, but at one steady speed, so the ratios are not distorted by compiled code kicking in halfway through.
Go deeper:
Empirical orders of growth — estimating the growth class from timings at two input sizes.