2.2 Benchmarking Parallel Systems
A single timing is not a benchmark. A benchmark repeats the measurement, reports how much it varied, and states the conditions it ran under.
2.2.1 Warm-up and startup cost
The first run of a parallel system is different from the tenth. The first run includes startup cost: forking or spawning workers, loading libraries, compiling code. The tenth run is warm. These costs dominate small workloads and distort comparisons.
Measure the first run separately from steady state. A “startup cost” line in your results tells you when parallelization helps. If the first run takes 3 seconds and the second run takes 0.3 seconds, you need to understand why. Startup cost often includes garbage collection, library loading, or just-in-time compilation. Steady-state runs measure the actual work.
Exception: startup cost is the thing being measured
If your goal is to measure a forkserver or similar startup-optimized system, startup cost IS the interesting number. For sunlight, the headline measurement is time to first result, from a cold and from a warm template, at 8 and 32 workers. Startup cost matters because it answers the question: how fast can this system produce results? A user whose pool grows and shrinks with the load cares about this more than about steady-state efficiency on the hundredth task.
Many workloads run once
A data analysis pipeline may run once a day, paying worker startup on every run with no later runs to spread it over. When the run is short, that startup can matter more than parallel efficiency, and reporting only steady-state numbers hides when parallelization helps in practice.
2.2.2 Input size and scaling
Parallelization gains depend on input size. A tiny workload has high startup overhead relative to work. A large workload amortizes startup and shows pure parallelization gains.
Worked example
Assume a task with a fixed startup cost of 1 second and a per-work-unit cost of 0.01 seconds. Compare three input sizes:
- Input size 100 units: 1 + (100 × 0.01) = 2 seconds total
- Input size 1,000 units: 1 + (1000 × 0.01) = 11 seconds total
- Input size 10,000 units: 1 + (10000 × 0.01) = 101 seconds total
On the 100-unit task, startup is 50 percent of time. On the 10,000-unit task, startup is 1 percent. Parallelizing the 100-unit task with 4 workers helps little: at best, 2 seconds become 1 + 0.25 = 1.25. Parallelizing the 10,000-unit task with 4 workers takes it from 101 seconds to 1 + 25 = 26, because the startup cost is amortized.
Vary input size in your benchmark. Plot speedup against input size. Show that parallelization helps for large inputs but not for small ones. This teaches your reader the boundary where parallelization becomes worthwhile.
2.2.3 Worker count sweeps
Sweep the number of workers. Do not report a single worker count. Show speedup curves for 1, 2, 4, 8, 16, 32 workers if your machine supports them. This reveals scaling behavior. Superlinear speedup at 4 workers can become sublinear at 16. This shift tells you about cache behavior, context switching, and load balancing.
A worker count sweep shows when parallelization stops helping. If speedup saturates at 8 workers, adding more workers will not help your workload, even on a 32-core machine.
2.2.4 Replication and variance
Run each configuration several times and report the median with a measure of spread, either the interquartile range or a confidence interval for the median, together with the number of runs. Timings are rarely normally distributed. They often have a floor and a long tail of slow runs, so the mean and standard deviation describe them poorly unless you have checked the shape. Hoefler and Belli’s rules (see Further reading) ask for exactly this: do not assume normality without checking, and report confidence intervals for measurements that vary. To compare two systems, compare their intervals or use a rank-based test such as Wilcoxon’s, not two bare means. If variance is high, investigate why. High variance signals interference from the operating system, background processes, or randomness in your algorithm.
Eliminate sources of variance where you can. Close other programs. Disable dynamic frequency scaling. Use CPU affinity to pin workers to specific cores if your platform supports it. But do not hide variance that is real. If your benchmark is inherently noisy, say so.
Variance matters more for parallel benchmarks because overhead is variable. Worker startup time, context switches and load imbalance all change from run to run, so report the spread as you measured it.
2.2.5 Disclosing the machine
Report the hardware. Include CPU model, core count, cache size, memory size, and operating system. Include whether you ran on dedicated hardware or in a cloud instance with noisy neighbors. A benchmark on a laptop is not comparable to one on a 64-core server.
Report background load. If the machine was idle, say so. If other processes were running, describe them. This context shapes how much a reader will trust your numbers.
Failure modes
Reporting a benchmark from a cloud instance without mentioning noisy neighbors is deceptive. A shared cloud instance has unpredictable interference. The same benchmark on dedicated hardware will look different. Readers cannot generalize your results to their hardware.
Reporting a spread under 5 percent when the runs varied by 20 percent misleads every reader who decides on that number. Cherry-picking the fast runs does the same.
2.2.6 Throughput versus latency
Throughput is the number of tasks completed per unit time. Latency is the time to complete one task. These are different.
A parallel system can have high throughput and still make some tasks wait a long time. Startup overhead spreads across many tasks, which keeps throughput high, but every task that arrives before startup finishes waits for it. Report both metrics. Real-time readers need different numbers than batch processing readers.
Example
A forkserver with one worker processes a queue of tasks. Startup takes 3 seconds and each task 0.1 seconds. After startup, throughput is 10 tasks per second. A task submitted at time zero waits through the 3 seconds of startup before its 0.1 seconds of work, so its latency is 3.1 seconds. The throughput looks good while the first results are slow.
2.2.7 When a benchmark is sufficient
Stop benchmarking when you can make a claim with confidence. For example: “On a 32-core machine with 128 GB of memory, this pipeline achieves 8x speedup at 8 workers and 16x at 32 workers. Speedup is sublinear due to load imbalance in matrix factorization. Across ten runs, the interquartile range is under 5 percent of the median. I ran on dedicated hardware with no background load.”
This tells readers what they need to interpret the results. They can decide whether the numbers apply to their hardware.
2.2.8 Mistakes in parallel benchmarking
One common mistake is running a parallel benchmark once and reporting the time. A single run is noise, not a benchmark. Variance affects parallel systems more than serial systems because multiple independent workers contribute independent variance. Three runs show whether the timings agree at all, but they cannot give a 95 percent confidence interval for the median; that takes at least six. Hoefler and Belli’s advice is to keep adding runs until the interval is as narrow as the comparison needs.
Another mistake is failing to match input size between serial and parallel runs. A serial baseline on a small input will look faster than a parallel run on a large input because parallelization overhead is amortized differently. Keep input size constant when measuring speedup. Comparing a serial version on small input to a parallel version on large input mixes problem scaling with parallelization.
A third mistake is confusing throughput and latency. A high-throughput system processes many tasks but each individual task takes a long time. Do not report throughput when the reader cares about latency. They are different numbers for different questions.
A fourth mistake is running benchmarks in the cloud without disclosing the instance type and whether the instance was busy. Cloud performance varies. A shared instance with noisy neighbors gives different results than dedicated hardware. Readers cannot generalize your results to their hardware without this information.
Example of a flawed benchmark
“The parallel system processes 1000 tasks per second. Serial processing takes 1 minute for 1000 tasks.”
What this hides: task size, worker count, machine spec, whether variance was measured, whether startup cost is included, whether tasks fit in cache.
A better benchmark: “On a 16-core machine with 128 GB RAM (CPU model X), the parallel system completes 1000 tasks of 1 MB each in 12.5 seconds (median of 10 runs, interquartile range 0.3 s). The serial version takes 160 seconds. Speedup is 12.8x with 16 workers, efficiency is 80 percent. Measured on dedicated hardware. All 10 runs are shown in Table 1.”
A reader can check this one against their own hardware.
2.2.9 Reproducibility and disclosure
Benchmarks are reproducible only if you disclose the setup. Report:
- Machine: CPU model, core count, cache size, memory, motherboard (NUMA matters)
- Software: R version, package versions, OS version, compiler flags
- Inputs: problem size, data shape, distribution, random seed if applicable
- Method: warm-up runs, replication count, variance metric, outlier handling
- Conditions: idle machine or background load, frequency scaling on or off, CPU affinity
A benchmark without this disclosure cannot be generalized or reproduced. It is anecdote, not measurement.
Ways to ruin a benchmark
Report a single number with no context. Report speedup without stating the baseline. Report on cloud hardware without naming the instance type. Report on a system with background load running. These omissions make numbers meaningless.
2.2.10 When warm-up actually matters
Warm-up matters for JIT-compiled languages and for code paths that use caches. The first run is cold. The second run is warm. These are different and both matter if your system runs multiple tasks.
R has warm-up effects of its own. The byte-code JIT, on by default at level 3, compiles larger closures before their first use and some small ones before their second, so the first calls include compile time. Lazy-loaded package objects are read from disk the first time they are touched, and the heap grows to its working size over the first collections. Discard the first run, or report it separately, and measure the steady state from the runs after it.
Keep the cold run when the time to first result is the question. For a forkserver, the time to first result includes worker startup, so do not warm up away the thing you are measuring.
2.2.11 Benchmark vs profile
Profiling answers “where does time go?” Benchmarking answers “how long does a task take?” They measure different things.
Profiling drives optimization. Benchmarking validates the results. Use profiling to find the bottleneck. Use benchmarking to measure whether your fix worked.
A good workflow: profile once, optimize, benchmark with enough runs to give an interval, and report the results with their spread.
Further reading
- bench, which reports memory allocations and garbage collections alongside timings. https://bench.r-lib.org/
- microbenchmark, for sub-millisecond timings. https://cran.r-project.org/package=microbenchmark
- Hoefler, T. and Belli, R. (2015). “Scientific Benchmarking of Parallel Computing Systems”. SC15. Twelve reporting rules, from how to state a speedup baseline to when to use the median and nonparametric confidence intervals. https://doi.org/10.1145/2807591.2807644
- Gregg, B. Systems Performance, 2nd edition. The benchmarking chapter covers the ways a benchmark can be accidentally dishonest. https://www.brendangregg.com/systems-performance-2nd-edition-book.html
- TechEmpower Web Framework Benchmarks, as an example of publishing hardware, versions and methodology alongside numbers. https://www.techempower.com/benchmarks/