How to Slow Down a Program? And Why it Can Be Useful
14 points by asb
14 points by asb
At first I was surprised that NOP turned out to be the best slowdown instruction, but on further thought it makes sense. AIUI on CPUs made in the last, uh, 15+ years (?) NOPs (and MOV r,r) are implemented in the front end; this means NOP perturbs very little of the CPU’s execution resources, so it makes sense that NOP has very tight slowdown variance. My surprise was roughly, “can’t the CPU skip over a NOP in basically zero time?!”, but of course if you put in enough NOPs then you eat up the available front-end instruction bandwidth, and when the bandwidth drops below the program’s ILP you get a slowdown.