Re: [OT] Premature optimizations
Re: [OT] Premature optimizations
- Subject: Re: [OT] Premature optimizations
- From: m <email@hidden>
- Date: Thu, 29 Jul 2004 19:01:03 -0700
On Jul 29, 2004, at 3:19 PM, Nat! wrote:
m wrote:
"Premature optimization is the root of all evil in programming."
Yes and goto considered harmful ... Is this favoring the point of view
that "Programmers are notorious for optimizing the wrong code" or is
it against it ? It has nothing to do with it.
The quote is a reflection of the fact that before you know the overall
behavior of your system, it's difficult to know what parts will
dominate its overall performance. In a complex enough system, it will
be difficult to accurately predict which parts should be optimized.
Even for *really good* algorithmists like Knuth and Hoare.
So in a more precise formulation: "in complex systems, programmers
aren't good at predicting what code the system spends most of it time
in."
variously attributed to such algorithm giants (who know more than you
or me) as Tony Hoare and Don Knuth? Not to mention lots of books on
the subject that recommend getting your code working, *then* finding
the bottle necks?
I doubt, that the "premature optimization" mantra was coined with the
idea in mind, that you should use sloppy algorithms at the foundation
of your work. Those guys would have said, that it makes good sense to
pick the right datastructure for the program and not for example use
arrays for everything.
Of course, no one is saying you should program like a moron. By all
means, use the appropriate data structures and algorithms for the task
at hand.
However before you go to heroic efforts at speeding up a bit of code,
make sure the effort (and any tradeoffs between speed, maintainability,
readability, etc) will be worth it.
_murat
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.