• 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: BOOL array
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BOOL array


  • Subject: Re: BOOL array
  • From: Andy Lee <email@hidden>
  • Date: Tue, 9 Sep 2008 14:30:04 -0400

On Sep 9, 2008, at 12:43 PM, Quincey Morris wrote:
On Sep 9, 2008, at 03:24, Alex Reynolds wrote:

I am currently putting 320 to 480 character long NSString * instances into an NSMutableArray. The characters are 0 or 1.

I guess I could use an int array, but I'm looking to speed up my app and reduce storage. Is it possible to create a BOOL array that can be put into an NSMutableArray?

Or use NSMutableData objects with 1 byte for each 0 or 1 value. You can then get the BOOL values as 'data.bytes [index]', set them with 'data.mutableBytes [index] = someBool' and resize the array with 'data.length = someLength'. In terms of source code, that's about as minimalistic as it gets without being pure C.

Very nice. This is simple, it performs well, and depending on how you're storing the data, might possibly cut down the storage space of your array significantly (for example if you're using a plist).


My only question would be how many of these arrays you have and how often you're stuffing booleans into them, and whether you're sure operations on this array are actually taking a noticeable amount of time.

--Andy

_______________________________________________

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: 
 >BOOL array (From: Alex Reynolds <email@hidden>)
 >Re: BOOL array (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: While we're on the subject of DMG's for software distribution...
  • Next by Date: singleton managed object / obtaining mo context
  • Previous by thread: Re: BOOL array
  • Next by thread: Re: BOOL array
  • Index(es):
    • Date
    • Thread