Bug 546354 - RetargetBreakpointAction can slow down workbench
Summary: RetargetBreakpointAction can slow down workbench
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 4.12   Edit
Hardware: PC Windows 10
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Platform-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-11 17:18 EDT by Michael Keppler CLA
Modified: 2021-10-08 07:52 EDT (History)
3 users (show)

See Also:


Attachments
profiler screenshot (37.16 KB, image/png)
2019-04-11 17:18 EDT, Michael Keppler CLA
no flags Details
back traces from profiler (21.82 KB, text/plain)
2019-04-14 04:55 EDT, Michael Keppler CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Keppler CLA 2019-04-11 17:18:10 EDT
Created attachment 278244 [details]
profiler screenshot

My platform workspace has about 11.000 warnings. With problems view limits removed, and those warnings expanded, scrolling through the problems view hogs my CPU completely and gives me only about 1 scrolled item per second.

All the time is burnt in RetargetBreakpointAction. It seems to calculate the selection of the active view on _any_ selection change, and this calculation is rather costly for tree views with a huge number of items (since it iterates all items, each time).

While this diagnosis is straightforward, I have no idea what that action does and how to get around the performance penalty (besides deferring the selection evaluation using a provider instead of the selection itself). Anyone with some insights about RetargetBreakpointAction?
Comment 1 Sarika Sinha CLA 2019-04-12 01:05:14 EDT
Can you get the trace that from where this method is invoked ?
org.eclipse.debug.internal.ui.actions.breakpoints.RetargetBreakpointAction.selectionChanged(IAction, ISelection)

RetargetBreakpointAction should not be invoked at all from Problems View scroll.
Comment 2 Michael Keppler CLA 2019-04-14 04:55:12 EDT
Created attachment 278273 [details]
back traces from profiler

My fault probably: With scrolling I meant using "Cursor down" in the problems view, thereby changing its selection.

Stack trace attached (from profiler, not from Eclipse).
Comment 3 Andrey Loskutov CLA 2019-12-06 08:31:36 EST
I've tried to reproduce, but I don't see the CPU load *on selection change* in Problems view at all (except that selecting all my project to see 20000 warnings in the problems view freezes UI for ~3 minutes).

However, from the comment on org.eclipse.debug.internal.ui.actions.RetargetAction.selectionChanged(IAction, ISelection) : "if the active part did not provide an adapter, see if the selection does" I assume this is a design choice to inspect *all* selection events.
Comment 4 Markus S CLA 2021-09-07 01:38:40 EDT
Running 4.20 and every single selection in the package explorer freezes the UI for 1-2 seconds.

Stack trace:
> Name: main
> State: RUNNABLE
> Total blocked: 1.504  Total waited: 553
> 
> Stack trace: 
> org.eclipse.swt.internal.win32.OS.WaitMessage(Native Method)
> org.eclipse.swt.widgets.Display.sleep(Display.java:4709)
> org.eclipse.ui.application.WorkbenchAdvisor.eventLoopIdle(WorkbenchAdvisor.java:339)
> org.eclipse.ui.internal.ide.application.IDEWorkbenchAdvisor.eventLoopIdle(IDEWorkbenchAdvisor.java:994)
> org.eclipse.ui.internal.Workbench$1.eventLoopIdle(Workbench.java:479)
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1162)
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
> org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
> org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
> org.eclipse.ui.internal.Workbench$$Lambda$149/0x0000000800ddec40.run(Unknown Source)
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
> org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
> jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> java.lang.reflect.Method.invoke(Method.java:564)
> org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:654)
> org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
> org.eclipse.equinox.launcher.Main.run(Main.java:1462)
Comment 5 Markus S CLA 2021-09-07 02:24:58 EDT
I'm sorry I just realized I copied the wrong stack trace, please ignore the last one. This is the proper one:

> Name: main
> State: RUNNABLE
> Total blocked: 1.935  Total waited: 2.169
> 
> Stack trace: 
> org.eclipse.swt.internal.win32.OS.SendMessage(Native Method)
> org.eclipse.swt.widgets.Tree.getSelection(Tree.java:3497)
> org.eclipse.jface.viewers.TreeViewer.getSelection(TreeViewer.java:231)
> org.eclipse.jface.viewers.AbstractTreeViewer.getSelection(AbstractTreeViewer.java:2990)
> org.eclipse.debug.internal.ui.actions.RetargetAction.getTargetSelection(RetargetAction.java:69)
> org.eclipse.debug.internal.ui.actions.breakpoints.RetargetBreakpointAction.getAdapter(RetargetBreakpointAction.java:49)
> org.eclipse.debug.internal.ui.actions.RetargetAction.selectionChanged(RetargetAction.java:141)
> org.eclipse.debug.internal.ui.actions.breakpoints.RetargetBreakpointAction.selectionChanged(RetargetBreakpointAction.java:75)
> org.eclipse.ui.internal.PluginAction.refreshEnablement(PluginAction.java:201)
> org.eclipse.ui.internal.PluginAction.selectionChanged(PluginAction.java:264)
> org.eclipse.ui.internal.PluginAction.selectionChanged(PluginAction.java:288)
> org.eclipse.ui.internal.e4.compatibility.SelectionService.notifyListeners(SelectionService.java:266)
> org.eclipse.ui.internal.e4.compatibility.SelectionService.handleSelectionChanged(SelectionService.java:98)
> org.eclipse.ui.internal.e4.compatibility.SelectionService.lambda$0(SelectionService.java:72)
> org.eclipse.ui.internal.e4.compatibility.SelectionService$$Lambda$333/0x00000008010d3440.selectionChanged(Unknown Source)
> org.eclipse.e4.ui.internal.workbench.SelectionAggregator$1.run(SelectionAggregator.java:123)
> org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
> org.eclipse.e4.ui.internal.workbench.SelectionAggregator.notifyListeners(SelectionAggregator.java:120)
> org.eclipse.e4.ui.internal.workbench.SelectionAggregator$5.lambda$0(SelectionAggregator.java:220)
> org.eclipse.e4.ui.internal.workbench.SelectionAggregator$5$$Lambda$721/0x000000080143bc40.run(Unknown Source)
> org.eclipse.e4.core.contexts.RunAndTrack.runExternalCode(RunAndTrack.java:59)
>    - locked org.eclipse.e4.ui.internal.workbench.SelectionAggregator$5@56a71ecd
> org.eclipse.e4.ui.internal.workbench.SelectionAggregator$5.changed(SelectionAggregator.java:220)
> org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:108)
> org.eclipse.e4.core.internal.contexts.EclipseContext.processScheduled(EclipseContext.java:364)
> org.eclipse.e4.core.internal.contexts.EclipseContext.set(EclipseContext.java:379)
> org.eclipse.e4.ui.internal.workbench.SelectionServiceImpl.setSelection(SelectionServiceImpl.java:34)
> org.eclipse.ui.internal.e4.compatibility.CompatibilityPart.selectionChanged(CompatibilityPart.java:471)
> org.eclipse.jface.viewers.Viewer$1.run(Viewer.java:151)
> org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
> org.eclipse.ui.internal.JFaceUtil$$Lambda$115/0x0000000800cde040.run(Unknown Source)
> org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:174)
> org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:148)
> org.eclipse.jface.viewers.StructuredViewer.updateSelection(StructuredViewer.java:2132)
> org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredViewer.java:1178)
> org.eclipse.jface.viewers.StructuredViewer$4.widgetSelected(StructuredViewer.java:1207)
> org.eclipse.jface.util.OpenStrategy.fireSelectionEvent(OpenStrategy.java:242)
> org.eclipse.jface.util.OpenStrategy.access$4(OpenStrategy.java:237)
> org.eclipse.jface.util.OpenStrategy$1.handleEvent(OpenStrategy.java:402)
> org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
> org.eclipse.swt.widgets.Display.sendEvent(Display.java:4209)
> org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1043)
> org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4026)
> org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3626)
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157)
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
> org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
> org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
> org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
> org.eclipse.ui.internal.Workbench$$Lambda$149/0x0000000800ddec40.run(Unknown Source)
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
> org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
> jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> java.lang.reflect.Method.invoke(Method.java:564)
> org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:654)
> org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
> org.eclipse.equinox.launcher.Main.run(Main.java:1462)
>