-validateMenuItem: like crazy, hogs CPU for 1st minute
-validateMenuItem: like crazy, hogs CPU for 1st minute
- Subject: -validateMenuItem: like crazy, hogs CPU for 1st minute
- From: Jerry Krinock <email@hidden>
- Date: Fri, 19 Mar 2010 11:33:13 -0700
This morning I was noticing that text fields could not keep up with my typing into them. But this only occurs during the first minute or so after my app is launched, and sampling shows that the main thread is spending most of its time in my app delegate's -validateMenuItem:.
I do have a couple items in the main menu which take 0.1 and 0.3 seconds to validate because they have dynamic submenus which access the Keychain to look for available account information. Yes, I could redesign and cache this information, but before I spend time doing and (and debugging!) that, I thought I should try and learn what's going on.
I can understand that when the app launches, for efficiency, Cocoa might want to validate all the menu items while the user is sipping coffee and pondering what to do. But these long-validating dynamic menu items (in the Application) get validated typically 100 times in the first 53 seconds. Other items in the Application menu only get validated 88 times, and other menus (Edit, Window, etc.) get validated less or not at all. It's inexplicable.
After 53 seconds, and sometimes a few last gasps, it quiets down and then never again validates until a menu is clicked.
Is there any way to get Cocoa to relax a little bit with the -validateMenuItem? Or, could someone give a better explanation of what it's trying to do, so I could try and help it out?
Thanks,
Jerry_______________________________________________
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