In Addition to C++ Optimization

In addition to the recent discussion about C++ optimization: In this CodeGuru Forums thread people talk about optimizing conditional branches like

if (a == 0) x = c;

Interesting, sure, though I still agree with this post, which argues that:

If there was a REAL performance benefit to be made, don't you think the compiler designers would have added this in their optimizer already? Compiler benchmarks are a big issue, and they add a LOT more complicated type optimisations than this. Most of the time, if you want to get better performance, you have to rethink the program at a higher level. Put your brains at work to find a better design, and let the compiler twiddle the bits for you.

Published: January 03 2005