We will first discuss the performance problems encountered when using the classic C++, that is, its pre-C++11 version. This is the very basic knowledge that we, in fact, expect the intermediate programmer to master, but we will nonetheless provide a quick refresher about it.
Traditional C++ optimizations
Low-hanging fruit
As we already said in Chapter 1, Understanding Performant Programs, there are some techniques that are so simple that they cost you nothing and buy you small but consistent performance gains.
They are more like habits than real techniques, to be frank. In C++ such absolute basics are, for example, as follows:
- Using ++i instead of i++—a compiler should optimize that away, but why rely on that?
- Passing...