Nayana Adassuriya Nayana Adassuriya - 25 days ago 8
C++ Question

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

Herb Sutter's C++ coding standards says to avoid

Premature optimization
and
Premature pessimization
. But I feel both is doing the same thing. So expecting some help to clarify these two concept with the different among them. If you come-up with some examples, It will be more benefit for others.
Here is a good explanation about
Premature optimization
. But I couldn't find any for
Premature pessimization

Answer

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.