Re: NSMapTable with C strings as keys
Re: NSMapTable with C strings as keys
- Subject: Re: NSMapTable with C strings as keys
- From: Ian Joyner <email@hidden>
- Date: Thu, 30 May 2013 20:52:27 +1000
On 30 May 2013, at 12:33, Jens Alfke <email@hidden> wrote:
>
> On May 29, 2013, at 6:30 PM, Ian Joyner <email@hidden> wrote:
>
>> That seems to come out of a belief that well-structured code is code that runs poorly
>
> No, it’s a paraphrase of a famous quote by Don Knuth ("We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.”[1]) He later attributed this to C.A.R. Hoare.
OK, thanks, it was badly put on my part. I have Knuth's paper and will give it another read (after rereading Structured Programming (Dahl, Dijkstra, Hoare) which Knuth says will change your life).
What I am trying to point out though is that there is a misapprehension that premature optimization means writing structured code early on so don't structure it because you can always go and clean it up later. Rather I think we should write well-structured code as we go. Often that will result in efficient code (invariant statements not being in loops, etc), but that is not what is meant by premature optimization.
This kind of optimization is more about changing the algorithm than the code. We should beware not to lump well-structured code writing with premature optimization just because well-structured code usually ends up being optimized code. Well-structured code also ends up being more correct and more easily changed and refactored.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden