Optimizing Your C/C++ Applications, Part 1
developer.amd.com
developer.amd.com
The recommendationi in that case seems to be to write the comparison chain yourself. How is my comparison chain better than the compiler's?
I actually have one case where I made a function 3 times shorter code-wise and run over 2x faster simply by unrolling it completely--the rules for deriving values based on the loop index were so complicated that they were actually longer than the unrolled loop itself.
Same shame for the switch statement at tip #6.
-O2 and -O3 flags may do such low-level optimizations, I hope. But then why the tutorial?