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

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


  • Follow-Ups:
    • Re: NSNotificationCentre very slow - normal?
      • From: Kyle Sluder <email@hidden>
    • Re: NSNotificationCentre very slow - normal?
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: How to run a panel that customizes a new NSDocument
  • Next by Date: Re: NSNotificationCentre very slow - normal?
  • Previous by thread: Re: "Sticky" Event tracking
  • Next by thread: Re: NSNotificationCentre very slow - normal?
  • Index(es):
    • Date
    • Thread