Hi! Unfortunately, I have no direct idea of what could be wrong, but you can try the following: Enable NSTRACE (this is done in nsterm.h) -- this might give you a bit more information about what happens on the NS port side. You have to launch Emacs from a terminal window, though. Adding a pair of block_input() and unblock_input() has fixed similar problems, it might be worth a try here as well. If Emacs calls setMainMeny a lot, it might be an idea to try to reduce this, e.g. by only calling it when the meny really has been changed (unless this mechanism already is in place). -- Anders On Wed, Jun 8, 2016 at 8:04 AM, David Reitter wrote: > I am and users are experiencing regular high CPU load with the NS port, > which started some time around late 2015, but according to users co-incided > with an OS upgrade, too. I tried rolling back changes, with limited > success: it does seem though that very recently, the problem has become > much worse. > > Usually, Emacs goes into 100% CPU load, or sometimes high load. What > invariably shows up in my process samples is NSMenu _sidebandUpdate* (no > idea what that does), within ns_upgrade_menubar. The attachment (sorry, > could not export to text) shows an example. > > I’m getting the spinning beachball sometimes when entering a minibuffer > for a command. > > I would like to fix this problem, but have been unsuccessful in tracing it > down. As you can see, we’re spending a lot of time in redisplay. > Is redisplay slow, or is it called again and again? > > Advice would be appreciated. (Yes, this is with Aquamacs, and I can’t > tell if the problem exists in GNU Emacs as it probably interacts with some > configuration.) > > > > Date/Time: 2016-06-08 15:32:29.059 +1000 > Launch Time: 2016-06-08 13:51:42.364 +1000 > OS Version: Mac OS X 10.11.4 (15E65) > Report Version: 7 > Analysis Tool: /usr/bin/sample > ---- > > Call graph: > 2484 Thread_453834: Main Thread DispatchQueue_ > + 2417 start (in libdyld.dylib) + 1 [0x7fff892d35ad] > + ! 2417 main () + 5602 [0x1000c3602] emacs.c:1606 > + ! 2417 Frecursive_edit () + 218 [0x1000c48ea] keyboard.c:755 > + ! 2417 recursive_edit_1 () + 101 [0x1000c46c5] keyboard.c:684 > + ! 2417 command_loop () + 158 [0x1000c47ae] keyboard.c:1078 > + ! 2417 internal_catch () + 54 [0x10013f6b6] eval.c:1074 > + ! 2417 command_loop_2 () + 48 [0x1000d45c0] > keyboard.c:1099 > + ! 2417 internal_condition_case () + 70 [0x10013fb46] > eval.c:1309 > + ! 2417 command_loop_1 () + 1154 [0x1000c5552] > keyboard.c:1357 > + ! 2417 read_key_sequence () + 1959 [0x1000c6e17] > keyboard.c:9101 > + ! 2417 read_char () + 5783 [0x1000ca407] > keyboard.c:2706 > + ! 2417 sit_for () + 261 [0x100008515] > dispnew.c:5762 > + ! 1694 wait_reading_process_output () + 1218 > [0x100183482] process.c:4609 > + ! : 1694 redisplay_preserve_echo_area () + > 44 [0x100028dfc] xdisp.c:14286 > + ! : 970 redisplay_internal () + 2034 > [0x100027282] xdisp.c:11850 > + ! : | 962 update_menu_bar () + 450 > [0x10004c9b2] xdisp.c:11960 > + ! : | + 869 ns_update_menubar () + 479 > [0x1001cba6f] nsmenu.m:139 > + ! : | + ! 868 -[NSApplication setMainMenu:] > (in AppKit) + 1584 [0x7fff8e8dc2c0] > + ! : | + ! : 868 -[NSMenu > _addSidebandMenuUpdaterForRoles:token:priority:handler:] (in AppKit) + > 229 [0x7fff8e8dc912] > + ! : | + ! : 868 -[NSMenu > _sidebandUpdaterRoles] (in AppKit) + 41,47,... > [0x7fff8e8dca4d,0x7fff8e8dca53,...] > + ! : | + ! 1 -[NSApplication setMainMenu:] > (in AppKit) + 655 [0x7fff8e8dbf1f] > + ! : | + ! 1 objc_msgSend (in > libobjc.A.dylib) + 26 [0x7fff8dbc54da] > + ! : | + 57 ns_update_menubar () + 1577 > [0x1001cbeb9] nsmenu.m:454 >