Re: NSNotificationCentre very slow - normal?
Re: NSNotificationCentre very slow - normal?
- Subject: Re: NSNotificationCentre very slow - normal?
- From: Kyle Sluder <email@hidden>
- Date: Wed, 21 Oct 2009 23:53:20 -0700
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.
HTH,
--Kyle Sluder
_______________________________________________
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