On Oct 21, 2009, at 11:32 PM, Graham Cox <[email protected]> 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 protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to