Re: NSMapTable with C strings as keys
Re: NSMapTable with C strings as keys
- Subject: Re: NSMapTable with C strings as keys
- From: Jens Alfke <email@hidden>
- Date: Wed, 29 May 2013 09:30:54 -0700
On May 28, 2013, at 9:14 PM, Oleg Krupnov <email@hidden> wrote:
> The code in question is frequently used in many places so I think it's worth optimization.
Did you actually profile the app and find that a lot of time is spent in this code?
> While I generally agree that premature optimization is evil, I do not understand why I cannot or shouldn't always keep in mind the cost of things I am using, and consider more efficient approaches, especially when they are simple. (This time it has turned out not simple and not even efficient, so I changed my mind).
Because the most important measure of time is the time you have available to develop the app. Any time you spend optimizing something is time you don’t have available to optimize a more significant piece of code, or add features, or fix bugs. Also, optimized code is often more complex than KISS code, making it less reliable, and harder to debug and improve.
Sometimes it’s really obvious that something is going to be a major bottleneck. (Or it’s not obvious, but you’re enough of an expert in the domain to know from experience that it will be.) And sometimes it’s almost as easy to do something efficiently than to do it slowly. But most often it does pay off to do it the simple way first and then go back and optimize only the things that are important.
—Jens
_______________________________________________
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