Premature optimization and Premature pessimization related to C++ coding standards

What he means by premature pessimisation, I think, is just the opposite of premature optimisation: a fundamental disregard of which data structures and algorithms to use.

Premature optimisation is often concerned with minute details of algorithms that can well be tweaked later and don’t need to be paid attention to at the beginning.

Premature pessimisation, by contrast, concerns the high-level design of code architecture: a fundamentally inefficient interface for your library for instance cannot be fixed later by optimising, since the public interface is pretty much cast in stone.


What Herb means is that when you are faced with two equally readable options, always choose the most efficient one.

Using std::vector::reserve() or the best standard container or algorithm is not premature optimization. However, not using them would be premature pessimisation.

Premature optimization is when you sacrifice readability for the sake of some "optimization" that might even not be worth it. Use a profiler for that.