3 ms·
If you're compute bound and are trying to optimize for performance, then sure, you only need to worry about loops. One way to think about this is that if you n
by microarchitect 15y ago
If you're compute bound and are trying to optimize for performance, then sure, you only need to worry about loops.
One way to think about this is that if you need optimize something, it's only because a particular task is taking at least a few seconds to execute. A few seconds means a few billion instructions on a modern CPU. There aren't any executables with billions of instructions of straight-line code so your code surely has a loop (or a million loops).
However, as many others have pointed out, this CPU-centric view won't give any insight into optimizing I/O bound applications.