Conclusion
Optimizing compilers are much better than they used to be:
- Years ago a talented programmer writing in assembly could beat any code produced by a compiler.
- This is no longer the case.
- If you provide high quality source code to a modern optimizing compiler, the result is likely to be better than anything you could write in assembly by hand. And it's certainly easier to write and maintain code in a higher level language than it is to do so in assembly!
- Just be sure you give the compiler a set of options that work well for the processor model(s) you have targeted.
But there are still limits to what even the best compiler can do:
- There are many, many things you as a programmer can do to help the compiler do a better job optimizing your code.
- There are at least as many things you can do that get in the way of compiler's valiant attempts to optimize your code.
- In this roadmap we have tried to help you begin to understand how to eliminate the bad things and do more of the good things so you and the compiler collaborate in producing fast code.
- ...or maybe you should just use a high-performance library instead. A good library is hard to beat.
*Conclusions are provided courtesy of Doug James of TACC, who kindly reviewed the original version of this roadmap.