On Wed, Jun 08, 2005 at 10:20:01AM +1000, Dave Robillard wrote:
"Premature optimization is the root of all
evil".
That's by Donald Knuth IIRC. Most of wht I know about programming
(I mean relevant things, not language or system nitty-gritty), comes
from hist ACP series of books, and I'd agree with almost everything
he says. But what is 'optimization' ?
When I choose to use a plain C aray instead of a vector, that is
*not* optimization, but a design choice.
In his books Knuth does not use any fancy high level programming
language to explain or demonstrate an algorithm. The language he
uses is something between assembly and C, and he has some very
good reasons for doing this (they are explained in the first book
IIRC).
There is a lot of 'optimization' going on and being discussed,
not of how something is expressed, but of the algorithms
themselves. So this happens even *before* coding, and qualifies
as 'very early optimization' :-). Apparently there's no evil here.
It's my experience that if you study your algorithms a bit before
you start coding, then very often the fancy high level stuff is not
needed and it just gets in the way.
Using C arrays and strings for no reason when a much
more robust
higher level type would suffice...
To me this sounds like "using 1 kg of dynamite when 100 kg would
suffice..."
--
FA