A For Loop Is Not What Your CPU Actually Runs (opens in new tab)
Most programmers think of a for loop as a direct instruction to a computer. Write for i in range(1000), and the machine counts to a thousand. That mental model is wrong, and the wrongness is consequential. The distance between the code you write and the operations your CPU performs is not a detail. It is the entire story of modern computing performance. The Code You Write Is a Polite Suggestion When you write a for loop in Python, C, or Java, you are not writing machine instructions. You are ...
Read the original article