Comparing Scaling with Empirical Timings
Comparing timings at several input sizes can reveal trends, while an operation-count argument explains why a trend is expected to persist.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Make input shapes comparable
Measure the same absent search at lengths 100, 200, and 400. First-position matches answer a different question even at the same lengths. Worst-case witnesses can guide those choices.
Avoid reading noise as a trend
Warm-up, I/O, and system load can affect individual measurements. Repeat long enough to capture a useful range, keep the same environment, and compare the result with a relevant operation model.[1]
Compare ratios using an explicit hypothetical sample
Suppose the median time for a scan is 2, 4 and 8 milliseconds at sizes one thousand, two thousand and four thousand. A pair scan might show 5, 20 and 80 for those same sizes. These patterns resemble linear and quadratic growth under size doubling. See constant factors.
Size scan pair scan
1000 2 ms 5 ms
2000 4 ms 20 ms
4000 8 ms 80 ms
Use measurements to investigate a prediction
Timing patterns do not prove a complexity theorem. Cache boundaries, warm-up and noise can affect ratios. Keep the input distribution comparable and report repeated samples. If larger sizes no longer fit comfortably in memory, that behavior is part of the experiment.