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

Re: FIFOs.


  • Subject: Re: FIFOs.
  • From: "John C. Randolph" <email@hidden>
  • Date: Mon, 20 Aug 2001 07:20:34 -0700

On Monday, August 20, 2001, at 07:00 AM, Ondra Cada wrote:

John,

John C. Randolph (JCR) wrote at Mon, 20 Aug 2001 06:45:10 -0700:
JCR> I want a FIFO implemented as a proper thread-safe ring buffer that will
JCR> grow as necessary to prevent overflow, and avoid needless shuffling of
JCR> memory as your example will do. I want this FIFO to be writeable by one
JCR> thread while being read by another.

The "memory shuffling" is a roaring nonsense.

No it's not, it's a waste of cycles that grows proportionately with the number of items in the array, and it's a waste of cycles that's likely to be buried deep in a nested loop (at least in my code.) I've seen apps at several customer sites that had to do things like finalize objects for storage in a database before exiting, where there could easily be a hundred thousand objects that had to be checked. You may think the memory shuffling cost is trivial, but I assure you, it adds up.

There just might be one
application from 10000 which *MIGHT* have such demands that
NSMutableArray-based FIFO would be unuseable there, but even that I doubt.
Not speaking of the fact that NSMutableArray *CAN BE* (and, by some other's
message, actually _IS_) implemented as a ring buffer.

As for thread-safeness, well, add two more lines with locking. Still not
worth an API, by far.

Well then, is NSEnumerator worth having? After all, it's just a wrapper around an index, isn't it?

-jcr


For every complex problem there is an answer that is clear, simple, and wrong. -- H L Mencken


  • Follow-Ups:
    • Re: FIFOs.
      • From: Ondra Cada <email@hidden>
References: 
 >Re: FIFOs. (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: How to check a given input?
  • Next by Date: Re: FIFOs.
  • Previous by thread: Re: FIFOs.
  • Next by thread: Re: FIFOs.
  • Index(es):
    • Date
    • Thread