C++ Optimization Techniques

Is there a site that provides a great list of common C++ optimization practices? What I mean by optimization is that you have to modify the source code to be able to run a program faster, not changing the compiler settings.

I don't have a site off the top of my head but the book "Exceptional C++" by Sutter is superb for C/C++ development.

I highly recommend every C++ programmer read this book as it gives great insight in to not only optimization but smart usage of the language so that you will program truly exceptional.

Two ways to write better programs: Make best use of language Code Complete by Steve McConnell Effective C++ Exceptional C++ profile your application Identify what areas of code are taking how much time See if you can use better data structures/ algorithms to make things faster There is not much language specific optimization one can do - it is limited to using language constructs (learn from #1).

The main benefit comes from #2 above.

The best optimization one can get is by revisiting the design, and after profiling the performance relevant parts/algorithms of the application.

This is usually not language specific. What I mean is (just as an idea) if you would get 30% performance improvement by selecting a slightly better algorithm (or collection/container class) the improvement you can expect from a C++ related refactoring would be at most 2%.

A design improvement could give you anything above 30%. If you have a concrete application, the best strategy is to measure and profile the application.

Profiling gives usually the most instant idea of which parts are performance relevant.

This is kind of beyond the scope of this website. C++ doesn’t play into web development that often (unless you’re writing PHP modules etc)