• 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: NSArray - waste of time?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArray - waste of time?


  • Subject: Re: NSArray - waste of time?
  • From: Dave Camp <email@hidden>
  • Date: Wed, 25 Apr 2007 14:26:04 -0700

That would be important if profiling your application indicated you were using an inordinate amount of memory or time managing arrays. For most uses, the overhead of NSArray is not noticeable. Don't fall into the trap of premature optimization unless you have a very specific problem that requires it.

Dave

On Apr 25, 2007, at 2:02 PM, Fen Soares wrote:

There is also the footprint to consider, surely? A C-style array is likely
to be much smaller than an NSArray of objects, particularly in the case of
primitive data types such as floats vs NSNumber objects.


On 14/04/07, Scott Stevenson <email@hidden> wrote:


On Apr 14, 2007, at 11:26 AM, William Squires wrote:

> What advantage does using an NSArray/NSMutableArray have over using
> an ordinary C-style static/dynamic 'array'?

I think a better question is why you would want to use a C-style
array if you have don't have to.

NSArray is safer, easier to use, is natively supported throughout
Cocoa, and is bridged to the prodecural CFArrayRef structure. The
implementation is also available through Apple's open source
repositiory.

If you absolutely need to use every ounce of raw speed, you should
use a C-style array. Otherwise, make things easy on yourself and use
NSArray. You also might find this interesting:

http://ridiculousfish.com/blog/archives/2005/12/23/array/

- Scott

--- You are in a maze of testy little Java VMs, all subtly different.

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


  • Follow-Ups:
    • Re: NSArray - waste of time?
      • From: mathew <email@hidden>
References: 
 >NSArray - waste of time? (From: William Squires <email@hidden>)
 >Re: NSArray - waste of time? (From: Scott Stevenson <email@hidden>)
 >Re: NSArray - waste of time? (From: "Fen Soares" <email@hidden>)

  • Prev by Date: Re: Cannot get toolbar to appear in window
  • Next by Date: Re: NSArray - waste of time?
  • Previous by thread: Re: NSArray - waste of time?
  • Next by thread: Re: NSArray - waste of time?
  • Index(es):
    • Date
    • Thread