lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Mar 21, 2014, at 4:42 AM, steve donovan <> wrote:

The next is Knuth's famous "Premature optimization is the root of all
evil" quote - but in context. He is saying that most of a program does
not need optimization and so micro-optimizations should only happen
where they make a difference.

I’ve really never agreed with this idea, because it is founded on the assumption that the COST of optimization remains constant regardless of when it is done in the design process. Simple local optimizations can indeed be done with more or less constant cost at any point in a project, but stuff that requires significant architectural rework or API changes may have such a high cost late in a project that it becomes infeasible even if the benefit is high.

Another way of looking at it, is that deciding what is “premature” is the tricky bit ;)