• 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: NSNotificationCentre very slow - normal?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSNotificationCentre very slow - normal?


  • Subject: Re: NSNotificationCentre very slow - normal?
  • From: Graham Cox <email@hidden>
  • Date: Thu, 22 Oct 2009 21:15:29 +1100


On 22/10/2009, at 5:53 PM, Kyle Sluder wrote:

On Oct 21, 2009, at 11:32 PM, Graham Cox <email@hidden> wrote:

My question is, is this a known slow spot? I've never noticed NSNotificationCentre being so slow before, and can't think why it would be. And of course, what can I do to help it? I've temporarily removed the addObserver call in the code and sure enough it goes a lot faster. Trouble is, I do need that notification. Any ideas?

Just dealt with this in a tree controller scenario. In this case, I have my tree controller subclass listen for the ItemChanged notification unconditionally. It then figures out which node represents that item and calls a -noteItemChanged:(NSNotification*) aNotification method on it. This is much faster than N different observer registrations, because it avoids two bottlenecks: the registration side and the dispatch-based-on-notifying-object side.


Thanks Kyle (and Nick too), at least I know I'm looking at a known problem.

I'm trying to work out if this solution will fit my model. Right now it's hard to see how I can do it, but I'll keep thinking - thanks!

--Graham


_______________________________________________

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: 
 >NSNotificationCentre very slow - normal? (From: Graham Cox <email@hidden>)
 >Re: NSNotificationCentre very slow - normal? (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: "Sticky" Event tracking
  • Next by Date: Re: to implement a 1 sec repeating timer in a separate thread
  • Previous by thread: Re: NSNotificationCentre very slow - normal?
  • Next by thread: to implement a 1 sec repeating timer in a separate thread
  • Index(es):
    • Date
    • Thread