Community
Participate
Working Groups
I20080515-2000. When switching between two editors in 3.3 there were no calls to org.eclipse.ui.menus.CommandContributionItem.updateIcons(). Now in 3.4 this method is called 9 times due to CommandEvent/s being handled (call see stack below). This causes SWT ToolItems to be update/redrawn. This is responsible for 1/3 of the regression seen in JDT Text editor activation tests. On my machine this is 40-60 ms. Thread [main] (Suspended (breakpoint at line 303 in CommandContributionItem$2)) CommandContributionItem$2.commandChanged(CommandEvent) line: 303 Command$1.run() line: 511 SafeRunner.run(ISafeRunnable) line: 37 Command.fireCommandChanged(CommandEvent) line: 506 Command.setHandler(IHandler) line: 995 HandlerAuthority.updateCommand(String, IHandlerActivation) line: 457 HandlerAuthority.deactivateHandler(IHandlerActivation) line: 292 HandlerService.deactivateHandler(IHandlerActivation) line: 148 SlaveHandlerService.deactivateHandler(IHandlerActivation) line: 205 EditorActionBars(SubActionBars).setGlobalActionHandler(String, IAction) line: 523 TextEditorActionContributor.doSetActiveEditor(IEditorPart) line: 101 TextEditorActionContributor.setActiveEditor(IEditorPart) line: 143 EditorActionBars.partChanged(IWorkbenchPart) line: 335 WorkbenchPage$3.run() line: 628 SafeRunner.run(ISafeRunnable) line: 37 Platform.run(ISafeRunnable) line: 880 WorkbenchPage.activatePart(IWorkbenchPart) line: 617 WorkbenchPage.setActivePart(IWorkbenchPart) line: 3451 WorkbenchPage.requestActivation(IWorkbenchPart) line: 2998 EditorPane(PartPane).requestActivation() line: 272 EditorPane.requestActivation() line: 98 EditorPane(PartPane).setFocus() line: 318 EditorPane.setFocus() line: 127 EditorStack(PartStack).presentationSelectionChanged(IPresentablePart) line: 846 PartStack.access$1(PartStack, IPresentablePart) line: 829 PartStack$1.selectPart(IPresentablePart) line: 139 TabbedStackPresentation$1.handleEvent(TabFolderEvent) line: 133 DefaultTabFolder(AbstractTabFolder).fireEvent(TabFolderEvent) line: 267 DefaultTabFolder(AbstractTabFolder).fireEvent(int, AbstractTabItem) line: 276 DefaultTabFolder.access$1(DefaultTabFolder, int, AbstractTabItem) line: 1 DefaultTabFolder$2.handleEvent(Event) line: 87 EventTable.sendEvent(Event) line: 84 CTabFolder(Widget).sendEvent(Event) line: 1002 CTabFolder(Widget).sendEvent(int, Event, boolean) line: 1026 CTabFolder(Widget).sendEvent(int, Event) line: 1011 CTabFolder(Widget).notifyListeners(int, Event) line: 769 CTabFolder.setSelection(int, boolean) line: 3238 CTabFolder.onMouse(Event) line: 2013 CTabFolder$1.handleEvent(Event) line: 316 EventTable.sendEvent(Event) line: 84 CTabFolder(Widget).sendEvent(Event) line: 1002 Display.runDeferredEvents() line: 3801 Display.readAndDispatch() line: 3400 Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2387 Workbench.runUI() line: 2351 Workbench.access$4(Workbench) line: 2203 Workbench$5.run() line: 493 Realm.runWithDefault(Realm, Runnable) line: 288 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 488 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149 IDEApplication.start(IApplicationContext) line: 112 EclipseAppHandle.run(Object) line: 193 EclipseAppLauncher.runApplication(Object) line: 110 EclipseAppLauncher.start(Object) line: 79 EclipseStarter.run(Object) line: 379 EclipseStarter.run(String[], Runnable) line: 179 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 597 Main.invokeFramework(String[], URL[]) line: 549 Main.basicRun(String[]) line: 504 Main.run(String[]) line: 1236 Main.main(String[]) line: 1212
Created attachment 100631 [details] Profiler Data
This also slows down editor opening (tests).
Created attachment 102018 [details] Change to CommandContributionItem This changes the updateIcons to only update on creation or if an Icon is deliberately set. Below is for information only, it was taken on linux where the system doesn't exhibit the same slowdown w.r.t. icons. I'll get a windows box tomorrow to test. My baseline: Elapsed Process: 9.18s (95% in [8.91s, 9.46s]) Measurable effect: 538ms (0.7 SDs) (required sample size for an effect of 5% of mean: 42) CPU Time: 2.35s (95% in [2.12s, 2.58s]) Measurable effect: 450ms (0.7 SDs) (required sample size for an effect of 5% of mean: 442) With icon change: Elapsed Process: 9.73s (95% in [9.46s, 10s]) Measurable effect: 521ms (0.7 SDs) (required sample size for an effect of 5% of mean: 35) CPU Time: 2.17s (95% in [1.96s, 2.38s]) Measurable effect: 412ms (0.7 SDs) (required sample size for an effect of 5% of mean: 437)
Created attachment 102377 [details] CommandContributionItem v02 Only call updateIcons() on creation or when the icon is set. PW
This change to updateIcons() resulted in a 7% savings in my SwitchEditor tests. Elapsed Process: 3.5s (95% in [3.43s, 3.56s]) Measurable effect: 135ms (0.3 SDs) CPU Time: 3.27s (95% in [3.2s, 3.33s]) Measurable effect: 134ms (0.3 SDs) Elapsed Process: 3.25s (95% in [3.19s, 3.31s]) Measurable effect: 123ms (0.3 SDs) CPU Time: 3.01s (95% in [2.95s, 3.07s]) Measurable effect: 125ms (0.3 SDs) PW
I think this is worth submitting for RC3
+1 no calls at all with the fix (it also used to spam the method on activation...), nice
Paul explained to me what the patch does. Looks good.
Released for I20080529-1300 PW