On Mon, Oct 20, 2008 at 11:45 AM, I. Savant <[EMAIL PROTECTED]> wrote: > On Mon, Oct 20, 2008 at 11:37 AM, Roland King <[EMAIL PROTECTED]> wrote: > >> I'm not sure I totally agree with step 0. I think there is value in >> understanding how your code is going to run, or is going to run most times, >> and picking constructs which are clearly efficient if it's really not more >> work to do so and it represents the data you're working with. > > Agreed. "The laptops! Won't somebody PLEASE think of the LAPTOPS!" > > Sure, our desktops are fast and the difference in 'extra work saved' > is usually imperceptible, but my laptop thanks you for your judicious > use of reasonably-optimized code. Mobile users need you to not waste > their battery power on pointless code execution.
Doesn't matter what you're running, because I don't advocate ignoring speed. Rather, I advocate a plan of action which produces the fastest code in the end. The simple fact is that most code is already fast enough, and should not be optimized. The effort that would go into optimizing it should instead be directed to the code where it can actually make a difference. The end result is an app that's faster than if you optimized everything. In the case of -initWithCapacity:, it's a very little effort being expended. But it's also a very little gain being realized. So it's better to leave off that little bit of mental effort altogether so that it might later be used in a place where it can do some more good. (And lastly, even "obvious" optimizations like preallocating memory can backfire. And you'll never know if it backfired unless you have both before and after measurements. So putting in the time to optimize code up front can give you a worse overall result even for that particular piece of code, let alone the entire app.) Mike _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]