• 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: Lots of NSTimers?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lots of NSTimers?


  • Subject: Re: Lots of NSTimers?
  • From: Bob Ippolito <email@hidden>
  • Date: Sat, 21 May 2005 05:36:24 -0400



On May 21, 2005, at 5:20 AM, Nathan Day wrote:

On 21/05/2005, at 8:51 AM, Karl Goiser wrote:

I have a requirement which involves (potentially) hundreds of independent NSTimer-style one-shot events.

Could anybody advise as to whether it would be better to use (hundreds of) NSTimers, or build a lightweight version with a time- sorted queue and one NSTimer for the next event?

(I guess this has to do with the internal implementation of NSTimer - are they all checked every time through the event loop, or is a callout queue used?)

Trying implement your own time-sorted queue would be simple duplicating Apples own NSTimer mechanism, do you think you can do a better job of it.


Well I can honestly say that there have been several occasions where I've seen dumb things in Apple's code that I'd have done differently. At worst case, you'll read the code and learn something. So, as I said, read the source to CFRunLoopTimer and see if it suits your needs. It's sitting right there in the CF sources.


If you decide that CFRunLoopTimer / NSTimer is implemented poorly, file some bugs, and they'll probably fix it.

-bob

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Lots of NSTimers? (From: Karl Goiser <email@hidden>)
 >Re: Lots of NSTimers? (From: Nathan Day <email@hidden>)

  • Prev by Date: Re: Lots of NSTimers?
  • Next by Date: Exclude files from backup
  • Previous by thread: Re: Lots of NSTimers?
  • Next by thread: NSDocument question...
  • Index(es):
    • Date
    • Thread