Timings and Operation Counts as Complementary Evidence
An operation count explains a model of scaling. A timing observation captures a particular runtime, workload, and hardware environment.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 4
- Reading time
- 1 min
In this article4 chapters
Trace two scans
Two procedures can both compare n records and have different timing because one repeatedly allocates a temporary object. Primitive operation counts reveal which work the model counted.
Use one result to interrogate the other
When measured growth differs from the model, inspect hidden copying, data shape, or I/O. Timing several sizes can make the difference clearer before profiling.[1]
Give one count a physical interpretation
Two searches each perform ten comparisons. If one compares integers and the other compares long strings with common prefixes, their elapsed times can differ. The count describes comparisons under an abstract model. Timing captures the environment and per-operation cost. See primitive work counts.
Algorithm A: 10 integer comparisons
Algorithm B: 10 string comparisons
Same abstract count
Costs depend on representation and hardware
Use both when diagnosing an unexpected result
Track comparison count and input lengths along with elapsed time. If counts remain stable while time changes, examine costs per operation, caches and allocation.