Re: Mutable arrays

2008-10-20 Thread Michael Ash
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, >

Re: Mutable arrays

2008-10-20 Thread Michael Ash
On Mon, Oct 20, 2008 at 10:40 AM, <[EMAIL PROTECTED]> wrote: > > Michael Ash wrote on 20/10/2008 15:31:01: >> And don't forget step 0: >> >> 0) Don't even bother >> >> A lot of people optimize code that's already plenty fast. A lot of >> people optimize code that *hasn't even been written yet*. Th

Re: Mutable arrays

2008-10-20 Thread Andy Lee
On Oct 20, 2008, at 11:37 AM, Roland King wrote: 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. Of

Re: Mutable arrays

2008-10-20 Thread I. Savant
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

Re: Mutable arrays

2008-10-20 Thread Roland King
On Oct 20, 2008, at 10:31 PM, Michael Ash wrote: On Mon, Oct 20, 2008 at 1:35 AM, j o a r <[EMAIL PROTECTED]> wrote: Some general suggestions for best practices wrt. optimizations: 1) Measure first 2) Implement supposed optimization 3) Measure to see the impac

Re: Mutable arrays

2008-10-20 Thread Jason Stephenson
DKJ wrote: Since mutable arrays and dictionaries expand as required when new objects are added, when should one use -initWithCapacity: methods? I have used it when my program can figure out roughly how many items will be in the mutable object to begin with. Say my program is pulling some

Re: Mutable arrays

2008-10-20 Thread graham . lee
Michael Ash wrote on 20/10/2008 15:31:01: > On Mon, Oct 20, 2008 at 1:35 AM, j o a r <[EMAIL PROTECTED]> wrote: > > Some general suggestions for best practices wrt. optimizations: > > > >1) Measure first > >2) Implement supposed optimization > >3) Measure to

Re: Mutable arrays

2008-10-20 Thread Michael Ash
On Mon, Oct 20, 2008 at 1:35 AM, j o a r <[EMAIL PROTECTED]> wrote: > Some general suggestions for best practices wrt. optimizations: > >1) Measure first >2) Implement supposed optimization >3) Measure to see the impact of the code change >4) Base

Re: Mutable arrays

2008-10-19 Thread j o a r
On Oct 19, 2008, at 10:11 PM, Graham Cox wrote: Since mutable arrays and dictionaries expand as required when new objects are added, when should one use -initWithCapacity: methods? I'd guess they're only worth using if you know you are about to populate one with a lot of ite

Re: Mutable arrays

2008-10-19 Thread Graham Cox
On 20 Oct 2008, at 4:06 pm, DKJ wrote: Since mutable arrays and dictionaries expand as required when new objects are added, when should one use -initWithCapacity: methods? I'd guess they're only worth using if you know you are about to populate one with a lot of items and the p

Mutable arrays

2008-10-19 Thread DKJ
Since mutable arrays and dictionaries expand as required when new objects are added, when should one use -initWithCapacity: methods? dkj ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments