The first benchmark can warm the second
A benchmark order can give one implementation a cold cache and the other a warm one. In this original synthetic model, that is enough to reverse the apparent winner.
A has a base cost of 6 units. B has a base cost of 8. Both use the same cache key, and a miss adds 10. These are invented units, not elapsed time.
| State and order | A invocation | B invocation | Setup total | Full-model total |
|---|---|---|---|---|
| Independent cold | 16 | 18 | 0 | 34 |
| Independent warm | 6 | 8 | 20 | 34 |
| Shared A then B | 16 | 8 | 0 | 24 |
| Shared B then A | 6 | 18 | 0 | 24 |
Every arm starts reset. The independent arms also reset before each call. In a shared arm, the first call pays the miss and leaves a hit for the second. A has the lower invocation cost in both equal-state comparisons; a single shared order answers a different question.
The warm arm does not get free setup. It prewarms separately before each call: 20 setup units plus 14 invocation units equals 34. Reset is assigned zero cost in the model, not measured as free on a real machine. The complete result retains every setup action and cache transition.
A declared equal-order mixture reuses the four shared rows. A averages 11 units; B averages 13. The ratio of means is 13/11. That is one cold and one warm row per implementation, not a universal estimate of steady-state performance.
The proof retains all eight main invocations and twelve separate conditional-control invocations. Ten authored checks cover the accounting and selected malformed inputs. With no miss penalty, different keys, or a shared prewarm, this particular order effect disappears. The prewarmed controls still include their setup costs. These are designed examples, not statistical evidence about real caches.
Google Benchmark’s guide documents warmup and random interleaving. PyTorch 2.15 Timer documents warmups for lazy initialization. That documentation is background; neither framework is executed here.
The practical question is which state you intend to compare: cold calls, warm calls, a sequential workload, or a specified mixture. Keep reset, warmup, order and setup costs with the result. There is no GPU measurement, real benchmark defect, training result or economic claim in this artifact.
Original Nodus example, with MIT source and complete retained output: canonical article.
About the author
- Founder @ Nodus Compute
Comments
Join the discussionNo comments yet. Be the first to comment.