[vox-tech] loop efficiency and testing against zero.

Micah J. Cowan micah at cowan.name
Fri Jun 16 14:39:28 PDT 2006


On Fri, Jun 16, 2006 at 02:31:10PM -0700, Rod Roark wrote:
> On Friday 16 June 2006 14:21, Micah J. Cowan wrote:
> ...
> > Optimization should always happen after implementation.
> 
> No generalization is worth a damn, including this one.

Absolutely.

And, in fact, I think that phrase (the one I just wrote a moment ago...)
is a bit simplistic and overused without qualification.

The truth is, if you know two ways to do something: an easy one that's
exponential-time, and a /slightly/ harder one that's linearythmic, by
golla, you'll do the linearythmic one... especially if you can pretty
much count on it being used frequently.

I think the thing you really want to warn against is nit-picky
optimizations that have exactly the same complexity (as denoted by the
Big Theta notation), but that just tweak the constant term, or the
constant multiplier by a negligible amount.

But "Optimization should happen after implementation" is quicker to say,
and is a good rule-of-thumb at any rate...

:-)

-- 
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer...
http://micah.cowan.name/


More information about the vox-tech mailing list