Re: NSEnumerator retaining objects?
Re: NSEnumerator retaining objects?
- Subject: Re: NSEnumerator retaining objects?
- From: James Bucanek <email@hidden>
- Date: Tue, 8 Mar 2005 14:39:08 -0700
Matt Gough wrote on Tuesday, March 8, 2005:
>
>On 8 Mar 2005, at 19:16, James Bucanek wrote:
>
>> It's no big deal, I just wanted to see if someone could confirm this
>> behavior. I'm been thinking about replacing the NSMutableArrays in my
>> tree with a simple linked-list, and this might just be reason to
>> justify it.
>>
>
>Why not just replace your code with a loop using [array objectAtindex:]?
That would certainly solve my immediate problem of the extra retain/autorelease. But I was thinking that if I had to go and replace every loop that uses NSEnumerator with a for/next, I figured I've already done about 60% of the work needed to replace the NSArrays with a linked list.
For this application, NSArrays are just a tad overkill (costing a minimum of 36 bytes per node), where a simple linked list would only cost 4 bytes per node. And traversing a linked list probably has less than 1/10th the overhead of either an NSEnumerator or using objectAtIndex.
On the other hand, I eventually want to sort these nodes someday, and NSArray has some mighty handy sorting methods. And I've written enough sorting routines by hand to know that I'm not excited about writing another one.
Decisions, decisions, ...
Thanks for all of the feedback. Now, it's back to work.
James
--
James Bucanek <mailto:email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden