Most optimizations are agnostic. Understand your code and understand the hardware you are running on, and you can perform most low-level optimizations.
Understand your problem domain and suitable algorithms, and you can perform any high-level optimizations.
The only C ++ optimization tip I can think of is to "understand what your code means." Understand when C ++ copies time series around, understands which constructors and destructors are called when.
And prefer functors to indicate pointers, since the former can be built in by the compiler. In general, move as much compilation time as possible, rather than run time. Use templates for heavy lifting.
And, of course, do not try to optimize until you have profiled and established that 1) optimization is necessary and 2) what needs to be optimized.
Edit: Comment commented that functors against function pointers are inline. Here is an explanation:
Functions are usually compiled separately. So, what does the compiler know about the F function, which takes a pointer to the FP function as an argument? Nothing, he should look for where F is called, and maybe there he can find a specific key as to what FP points to. If he can determine that when calling from here FP will ALWAYS point to function G, then yes, it can make an embedded version of F with an embedded inside it for this particular call site. But he cannot simply embed G without superimposing F, because F can be called from other places where another function pointer is passed to it. And even then, it requires some costly global optimizations to determine if something can be embedded.
Imagine you are passing a functor like this:
struct Ftor { void operator()() { ... } };
so the function F looks like this:
void F(const FTor& ft) { ... ft(); ... }
Now the compiler knows exactly which function is being called: line 2 in the function calls the Ftor :: operator () function. Thus, the challenge can be easily challenged.
Of course, in practice, you usually configure it, so the function can be called with any type of functor:
template <typename F> void F(const F& ft) { ... ft(); ... }