optimization (was Re: Which happens first?)

Alex Martelli aleaxit at yahoo.com
Mon Apr 9 04:02:04 EDT 2001


"Tim Peters" <tim.one at home.com> wrote in message
news:mailman.986770871.11086.python-list at python.org...
    [snip]
> BTW, it was a *surprise* to me that these sections weren't accounting for
> much more of the runtime than they did, so if I had gone with "my
intuition"
> I would have wasted time spiffing them up.  As is, I no longer like the

It can't be stressed too strongly that this IS PAR FOR THE COURSE in
optimization issues: a very experienced and savvy programmer eventually
learns that he WILL be surprised when measuring where the time is
really going (indeed, on the rare occasions where his intuition WAS
right, he will be surprised that it was!-).

This is no doubt part of the reasoning behind the well-known dictum
(generally attributed to Knuth, but HE calls it Hoare's maxim, if I
recall correctly), "Premature optimization is the root of all evil"...


Alex






More information about the Python-list mailing list