• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [OT] Premature optimizations
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: [OT] Premature optimizations
      • From: Chris Hanson <email@hidden>
References: 
 >Where is NSList? (From: Tim Conkling <email@hidden>)
 >Re: Where is NSList? (From: Shawn Erickson <email@hidden>)
 >Re: Where is NSList? (From: Tim Conkling <email@hidden>)
 >Re: Where is NSList? (From: Steve Checkoway <email@hidden>)
 >Re: Where is NSList? (From: Tim Conkling <email@hidden>)
 >Re: Where is NSList? (From: Dustin Voss <email@hidden>)
 >Re: Where is NSList? (From: Steve Checkoway <email@hidden>)
 >Re: Where is NSList? (From: Pandaa <email@hidden>)
 >Re: Where is NSList? (From: Steve Checkoway <email@hidden>)
 >[OT] Premature optimizations (was: Where is NSList?) (From: Allan Odgaard <email@hidden>)
 >Re: [OT] Premature optimizations (was: Where is NSList?) (From: m <email@hidden>)
 >Re: [OT] Premature optimizations (From: "Nat!" <email@hidden>)

  • Prev by Date: Re: What happens if I use 10.3 functions on 10.2?
  • Next by Date: Re: A good model header?
  • Previous by thread: Re: [OT] Premature optimizations
  • Next by thread: Re: [OT] Premature optimizations
  • Index(es):
    • Date
    • Thread