3 ms·
There are many different ways in which adding instructions improves absolute performance. Execution port saturation (the example in the article) is one. Another
by jandrewrogers 12y ago
There are many different ways in which adding instructions improves absolute performance. Execution port saturation (the example in the article) is one. Another one is where additional computation in-register is faster than simply loading a register with a new value (i.e. computation is faster than access). There is also instruction fusion, where a pair of assembly operations commonly used together are fused into a one, single-cycle operation inside the CPU. Optimization on modern micro-architectures has a lot of complex and sometimes counterintuitive rules but you can often squeeze substantial performance gains out of them if you know what you are doing.
One caveat to be aware of in the article's example: hyper-threading works by letting a second thread run on the CPU's execution ports that are unused by the first thread. Consequently, if you design your code to do an excellent job of saturating execution ports, it will often mean that hyper-threading is slower than using a single thread per core (all of the additional cache pressure, few free execution ports that allow the code to run). However, the speed improvements you can see on a single thread with excellent execution port saturation will often be higher than the speed improvements you will see from hyper-threading code that does not saturate the execution ports due to the aforementioned cache overhead of running a second thread concurrently.