Friday, September 29, 2006


Do You Suffer from Premature Optimisation?

Randall Hyde published a paper on The Fallacy of Premature Optimisation back in July 2006, which discusses the mindset required to create efficient code, and how it has been misconstrued:
Observation #1: "Premature optimization is the root of all evil" has become "Optimization is the root of all evil." Therefore, optimization should be avoided.
This is similar to an often misquoted biblical quote, “The love of money is the root of all evil” (which is misquoted as “Money is the root of all evil”).
What Hoare and Knuth are really saying is that software engineers should worry about other issues (such as good algorithm design and good implementations of those algorithms) before they worry about micro-optimizations such as how many CPU cycles a particular statement consumes.

This is something I try to explain to all junior programmers, and why it is important to have at least a basic understanding of algorithm order complexity, e.g. O(N ²) versus O(NlogN)

I saw this article via Rico Marini’s blog.


Powered by Blogger