• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSArrayController addObject or insertObject:atArrangedObjectIndex:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >NSArrayController addObject or insertObject:atArrangedObjectIndex: (From: BareFeet <email@hidden>)
 >Re: NSArrayController addObject or insertObject:atArrangedObjectIndex: (From: Dave Keck <email@hidden>)
 >Re: NSArrayController addObject or insertObject:atArrangedObjectIndex: (From: BareFeet <email@hidden>)

  • Prev by Date: Re: NSArrayController addObject or insertObject:atArrangedObjectIndex:
  • Next by Date: OR compositing operation?
  • Previous by thread: Re: NSArrayController addObject or insertObject:atArrangedObjectIndex:
  • Next by thread: Re: NSArrayController addObject or insertObject:atArrangedObjectIndex:
  • Index(es):
    • Date
    • Thread