• 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: WTF? How can this work?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WTF? How can this work?


  • Subject: Re: WTF? How can this work?
  • From: Greg Titus <email@hidden>
  • Date: Mon, 20 Aug 2001 10:40:40 -0700

On Monday, August 20, 2001, at 02:49 AM, John C. Randolph wrote:

On Sunday, August 19, 2001, at 06:34 PM, Chris Kane wrote:
Mutable collections tend to have "extra slots" allocated to avoid reallocation on every addition, which kills performance.

I don't suppose you have by any chance, any plans for a fragmentable array for those occasions where you might have a *lot* of objects in the array? Or, say, NSReallyBigAndNotNecessarilyContiguousData, for the future when we have a 64-bit address space?

While I'm on the wish list, it might be nice to have an NSQueue or NSFIFOArray.

Hi John,

Check out the CoreFoundation source code some time. There are several implementations of mutable CFArrays: for small arrays the implementation is a ring buffer (which is efficient for queues), and for very large arrays the implementation is to use a CFStorage, which looks sort of like an in-memory b-tree. I'm not sure what you mean by "fragmentable", but this probably qualifies.

Since NSMutableArray uses CoreFoundation, you've already got what you are looking for, more or less. It's true that the array isn't thread-safe, so you do need a couple more lines of code to write a thread-safe FIFO.

--Greg


References: 
 >Re: WTF? How can this work? (From: "John C. Randolph" <email@hidden>)

  • Prev by Date: Re: How to get the length of a string?
  • Next by Date: Sheet interferes with close widget and app quit
  • Previous by thread: Re: WTF? How can this work?
  • Next by thread: Re: WTF? How can this work?
  • Index(es):
    • Date
    • Thread