NSNotificationCentre very slow - normal?
NSNotificationCentre very slow - normal?
- Subject: NSNotificationCentre very slow - normal?
- From: Graham Cox <email@hidden>
- Date: Thu, 22 Oct 2009 17:32:09 +1100
Hi all,
I'm profiling some code to find out where it's spending all its time.
The code is a threaded task that parses a file and turns what it finds
into a bunch of objects. Some of these files are pretty large,
generating 25,000+ objects.
Basically after fixing a few slow bits with a useful improvement, I'm
still looking for more speed. Right now, I find that the code is
spending 45% of its time in [NSNotificationCenter -
addObserver:selector:name:object:] which is by far the biggest chunk.
The call stack leading to this call is taking negligible time, but it
then spends all its time in here (or specifically, in
_CFXNotificationRegister which it calls)
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?
--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