How to Slow Down a Program? and Why It Can Be Useful
14 days ago
- #programming
- #debugging
- #performance
- Slowing down programs can help detect race conditions, simulate speedups, and assess profiler accuracy.
- Approaches like CHESS, WAFFLE, and NACD use slowdown to explore different instruction interleavings and schedules.
- The Coz profiler uses slowdown to simulate speedups, helping estimate optimization benefits before implementation.
- Current slowdown methods are coarse-grained, often using Thread.sleep() or pausing execution.
- Fine-grained slowdowns, like inserting NOP or MOV instructions in basic blocks, can improve precision.
- Experiments on an Intel Core i5-10600 show NOP and MOV instructions are effective for controlled slowdown.
- Slowing down basic blocks by inserting NOPs can double execution time while maintaining accurate profiling results.
- The paper evaluates six x86 instruction candidates, finding NOP and MOV most suitable for fine-grained slowdown.
- Future research aims to use fine-grained slowdown for advanced developer tooling.