Project: SWT
Bug 95890 [Perspectives] MenuManager.update() causes menu to be redrawn too often
Reported: 2005-05-19 00:10:26 | Status: resolved fixed

When I change perspective 9 times, MenuManager.updateAll() is called 9 times. MenuManager.update(force,recursive) ends up being called 78 times. While removing the included obsolete menu items, mi[i].dispose() causes a redraw of the menu for each dispose, happening 162 times. MenuItem.dispose -> MenuItem.releaseChild -> Menu.destroyItem -> Menu.redraw. Menu.redraw is called 162 time and 4.1% of perspective switching is spent here. MenuManager.updateAll should contain code to say menu.setRedraw(false), do all the removals, and then do menu.setRedraw(true); As an aside, WorkbenchWindow.updateActionBars() uses 16.5% of CPU. Of that, MenuManager.updateAll() uses 15.1% and CoolbarManager.update() only 1.3%

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Menu.java