Re: NSArrayController addObject or insertObject:atArrangedObjectIndex:
Re: NSArrayController addObject or insertObject:atArrangedObjectIndex:
- Subject: Re: NSArrayController addObject or insertObject:atArrangedObjectIndex:
- From: Graham Cox <email@hidden>
- Date: Tue, 22 Sep 2009 23:06:04 +1000
On 22/09/2009, at 10:40 PM, BareFeet wrote:
2. Does addObject: and insertObject: actually just get the whole
array, add the extra object, then write the whole array back to the
instance variable? I thought it would be more efficient than that.
Not sure why you think this is inefficient, especially. An array in
this context is just a pointer to the array object - fetching the
"whole array" doesn't move anything, it just returns the pointer.
"Writing back" means what exactly? Doing a retain/release? That also
doesn't move or copy anything - it's super-cheap. If the array is
copied along the way there may be some overhead but it may not be all
that much.
--Graham
_______________________________________________
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