Re: NSNotificationCentre very slow - normal?
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