Bug 229073 - PDE launch configurations slow to open in dialog
Summary: PDE launch configurations slow to open in dialog
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal with 5 votes (vote)
Target Milestone: 3.5 M7   Edit
Assignee: Curtis Windatt CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
: 234116 240712 244513 246488 247507 263774 (view as bug list)
Depends on:
Blocks: 178152
  Show dependency tree
 
Reported: 2008-04-28 10:42 EDT by Curtis Windatt CLA
Modified: 2012-05-29 04:12 EDT (History)
14 users (show)

See Also:
caniszczyk: review+


Attachments
Call Tree (6.06 KB, application/zip)
2008-04-28 16:22 EDT, Curtis Windatt CLA
no flags Details
Work In Progress (10.86 KB, patch)
2008-06-10 16:38 EDT, Curtis Windatt CLA
no flags Details | Diff
Yourkit CPU snapshot (3.88 MB, application/zip)
2009-02-12 12:01 EST, Min Idzelis CLA
no flags Details
Yourkit CPU profiling HTML export (31.65 KB, application/zip)
2009-02-12 12:01 EST, Min Idzelis CLA
no flags Details
Launch config patch (5.72 KB, patch)
2009-02-12 15:47 EST, Min Idzelis CLA
no flags Details | Diff
Other patch (2.16 KB, patch)
2009-02-12 15:48 EST, Min Idzelis CLA
curtis.windatt.public: iplog+
Details | Diff
Lazy loading of the tree (20.22 KB, patch)
2009-03-17 17:31 EDT, Curtis Windatt CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Curtis Windatt CLA 2008-04-28 10:42:00 EDT
In the launch configuration dialog, opening a runtime workbench configuration or a junit plug-in test configuration, there is a significant pause (5 seconds or more).  This makes even small changes to a configuration an annoying experience.
Comment 1 Curtis Windatt CLA 2008-04-28 10:43:45 EDT
I'll look at this sometime, but probably not in 3.4.
Comment 2 Chris Aniszczyk CLA 2008-04-28 10:46:30 EDT
I would start here first as a possible bottleneck:

org.eclipse.pde.internal.ui.launcher.LaunchPluginValidator.parsePlugins(ILaunchConfiguration, String)
Comment 3 Curtis Windatt CLA 2008-04-28 16:22:15 EDT
Created attachment 97843 [details]
Call Tree

One place we might be able to make some improvements is PluginBlock.initializeFrom(ILaunchConfiguration, boolean).  As it's spending a long time building a table that's not even enabled.
Comment 4 Curtis Windatt CLA 2008-05-27 09:47:45 EDT
*** Bug 234116 has been marked as a duplicate of this bug. ***
Comment 5 Curtis Windatt CLA 2008-05-27 09:49:02 EDT
Note that the performance of the launch configuration validation affects more than just the opening of the configuration.  Typing in the name field can be slowed down by the work the config is doing when handling events.
Comment 6 Curtis Windatt CLA 2008-06-10 16:38:39 EDT
Created attachment 104387 [details]
Work In Progress
Comment 7 Michael Rennie CLA 2008-07-14 16:14:26 EDT
*** Bug 240712 has been marked as a duplicate of this bug. ***
Comment 8 Min Idzelis CLA 2008-08-29 14:34:22 EDT
I find that slowness is caused by a different call tree. Loading up a PDE launch configuration sometimes takes up to a minute on my 2.1Mhz Core2 laptop, during this time the UI is frozen and unresponsive. Running jstack on the Eclipse process yields this stack trace. 

This slowness only seems to occur when the "trace options" checkbox is used. This is really a very annoying problem. Could the "isTraceable" call be deferred until you actually switch to the tracing tab? And once you are there, could it be done to run in a non-UI thread so the UI remains responsive? 

"main" prio=6 tid=0x003a5c00 nid=0xc1c runnable [0x003fe000..0x003ffe5c]
   java.lang.Thread.State: RUNNABLE
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(ZipFile.java:114)
        at org.eclipse.pde.internal.core.TracingOptionsManager.isTraceable(TracingOptionsManager.java:113)
        at org.eclipse.pde.internal.ui.launcher.TracingBlock.getTraceableModels(TracingBlock.java:293)
        at org.eclipse.pde.internal.ui.launcher.TracingBlock.createPluginViewer(TracingBlock.java:108)
        at org.eclipse.pde.internal.ui.launcher.TracingBlock.createSashSection(TracingBlock.java:75)
        at org.eclipse.pde.internal.ui.launcher.TracingBlock.createControl(TracingBlock.java:68)
        at org.eclipse.pde.ui.launcher.TracingTab.createControl(TracingTab.java:56)
        at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.showInstanceTabsFor(LaunchConfigurationTabGroupViewer.java:835)
        at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.displayInstanceTabs(LaunchConfigurationTabGroupViewer.java:771)
        at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer$8.run(LaunchConfigurationTabGroupViewer.java:663)
        at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
        at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.inputChanged(LaunchConfigurationTabGroupViewer.java:680)
        at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.setInput0(LaunchConfigurationTabGroupViewer.java:642)
        at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTabGroupViewer.setInput(LaunchConfigurationTabGroupViewer.java:618)
        at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.handleLaunchConfigurationSelectionChanged(LaunchConfigurationsDialog.java:959)
        at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog$4.selectionChanged(LaunchConfigurationsDialog.java:566)
        at org.eclipse.jface.viewers.StructuredViewer$3.run(StructuredViewer.java:842)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
        at org.eclipse.core.runtime.Platform.run(Platform.java:880)
        at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
        at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
        at org.eclipse.jface.viewers.StructuredViewer.firePostSelectionChanged(StructuredViewer.java:840)
        at org.eclipse.jface.viewers.StructuredViewer.setSelection(StructuredViewer.java:1639)
        at org.eclipse.jface.viewers.TreeViewer.setSelection(TreeViewer.java:1104)
        at org.eclipse.jface.viewers.Viewer.setSelection(Viewer.java:392)
        at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.doInitialTreeSelection(LaunchConfigurationsDialog.java:606)
        at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.initializeContent(LaunchConfigurationsDialog.java:1061)
        at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.createContents(LaunchConfigurationsDialog.java:442)
        at org.eclipse.jface.window.Window.create(Window.java:431)
        at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1089)
        at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.create(LaunchConfigurationsDialog.java:371)
        at org.eclipse.jface.window.Window.open(Window.java:790)
        at org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.open(LaunchConfigurationsDialog.java:1113)
        at org.eclipse.debug.ui.DebugUITools$1.run(DebugUITools.java:388)
        at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
        at org.eclipse.debug.ui.DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUITools.java:396)
        at org.eclipse.debug.ui.DebugUITools.openLaunchConfigurationDialogOnGroup(DebugUITools.java:332)
        at org.eclipse.debug.ui.actions.OpenLaunchDialogAction.run(OpenLaunchDialogAction.java:81)
Comment 9 Chris Aniszczyk CLA 2008-09-02 11:58:39 EDT
*** Bug 244513 has been marked as a duplicate of this bug. ***
Comment 10 Chris Aniszczyk CLA 2008-09-02 13:08:52 EDT
I think we can do a better job of caching this information and delaying the actual call to read the .options files. The problem at hand is that we are going through each plug-in in the target platform and reading the .options settings... this is expensive :)
Comment 11 Chris Aniszczyk CLA 2008-09-07 18:10:43 EDT
*** Bug 246488 has been marked as a duplicate of this bug. ***
Comment 12 Chris Aniszczyk CLA 2008-09-16 11:01:07 EDT
*** Bug 247507 has been marked as a duplicate of this bug. ***
Comment 13 Chris Aniszczyk CLA 2008-09-22 11:34:11 EDT
I did some optimizations around how we load the .options files with bug 248152. This should help most people significantly with the performance issues they saw with the dialog.

Those changes will go into 3.5M3 and possibly 3.4.2

I will leave this open for further explorations and optimizations that Curtis was attempting.
Comment 14 Curtis Windatt CLA 2009-02-05 09:42:09 EST
*** Bug 263774 has been marked as a duplicate of this bug. ***
Comment 15 Min Idzelis CLA 2009-02-12 12:01:00 EST
Created attachment 125535 [details]
Yourkit CPU snapshot
Comment 16 Min Idzelis CLA 2009-02-12 12:01:43 EST
Created attachment 125536 [details]
Yourkit CPU profiling HTML export
Comment 17 Min Idzelis CLA 2009-02-12 15:43:41 EST
My remark in comment #8 no longer applies. The changes for bug 248152 seemed to make a difference. Now, the bottleneck is the "plugins" tab. 

The root cause of this is that the implementation of FilteredCheckboxTree is very inefficient. I tried to fix it, but I was not able to in the time I allotted myself. [details... if interested] I thought simply causing the auto-expand level of the tree to be 0 will solve the problem, however the checkbox state of the plugins causes eager loading of all items in the tree. This might be a canidate for the "deffered tree expansion" where children nodes are expanded on a background thread.[end details] Therefore, I went with original approach I mentioned in comment #8 - to defer the loading of that tab until it was actually visible. 

I was able to create a patch that *deffers* the loading of the plugins tab until the tab is *activated* instead of during the intializeFrom() method. Some initialization still occurs in the intilizeFrom() method (so that validation messages are still intact.) but the population of the FilteredCheckboxTree only happens when you switch to this tab. Switching to the plugins tab still incurs the very slow performance, however, ordinary usage of launch configurations is very snappy now. 


Comment 18 Min Idzelis CLA 2009-02-12 15:47:34 EST
Created attachment 125580 [details]
Launch config patch
Comment 19 Min Idzelis CLA 2009-02-12 15:48:44 EST
Created attachment 125581 [details]
Other patch

This one reduces the number of calls to the preferences service when sorting.
Comment 20 Curtis Windatt CLA 2009-02-12 16:09:26 EST
Cool, thanks for the patches.  I'll review them out and put them in for M6.  I was thinking that we should try and go one step further and delay the tree from initializing until it becomes editable.  It is silly for us to be taking that much of a performance hit just to populate a disabled tree.
Comment 21 Dani Megert CLA 2009-02-13 01:57:56 EST
>I was thinking that we should try and go one step further and delay the tree from
>initializing until it becomes editable.
Definitely. Loading stuff lazy is a key concept in eclipse.
Comment 22 Curtis Windatt CLA 2009-03-09 14:30:41 EDT
Moving to M7.
Comment 23 Curtis Windatt CLA 2009-03-17 17:31:31 EDT
Created attachment 129149 [details]
Lazy loading of the tree

With this patch the tree does not get an input unless the drop down is set to "selected plug-ins only".  Patch doesn't appear to break anything and it improved performance if you are not using  the tree to select certain plug-ins to launch.  I will do some more performance testing to see what else we can improve.

This patch also includes Min's changes to ListUtils.  I didn't include the 'activate tab' patch because it required debug to change the behaviour of the Launch configuration dialog and I had problems when multiple instances of the same config were open.
Comment 24 Curtis Windatt CLA 2009-03-20 11:33:49 EDT
I applied Min's "Other patch" and committed a fix to not fill in the table unless the user has chosen "plug-ins selected below only".  Without the table filling in the performance of the tab is roughly equivalent to the main tab or any of the other tabs.

Min is correct in that the FilteredCheckboxTree is a huge waste of CPU.  I was considering using it elsewhere in PDE and now will try and avoid it.  Working with the code in PluginBlock is a huge time sink, but if someone would like to take a shot at it go for it.

Since the main problem, the LCD taking forever to open, should be fixed in the most common case, I am marking this as FIXED.

Chris A, can you test out the dialog and verify?
Comment 25 Chris Aniszczyk CLA 2009-03-20 11:39:18 EDT
looks good. I would love to have an optimized FilteredCheckboxTree ;)
Comment 26 Boris Bokowski CLA 2009-03-20 14:47:07 EDT
(In reply to comment #25)
> I would love to have an optimized FilteredCheckboxTree ;)

We have some experimental code for this attached to bug 237359. All we need is someone to push it through.
Comment 27 Patrick Godeau CLA 2009-07-01 02:53:28 EDT
I installed 3.5 and I find the Run Configurations dialog is still incredibly slow, to open and to type text in fields. IMO this bug should be reopened.
Comment 28 Eric Rizzo CLA 2009-07-01 10:55:56 EDT
(In reply to comment #27)
> I installed 3.5 and I find the Run Configurations dialog is still incredibly
> slow, to open and to type text in fields. IMO this bug should be reopened.
> 

I see significant improvement in 3.5. I'm using a workspace that was created in 3.4, has a large RCP product (many plug-ins), uses a large target platform, and in 3.4 demonstrated the slowness in opening and switching between launches in the dialog.
In other words, it is much better by my observation.
Comment 29 Curtis Windatt CLA 2009-07-06 10:29:41 EDT
(In reply to comment #27)
> I installed 3.5 and I find the Run Configurations dialog is still incredibly
> slow, to open and to type text in fields. IMO this bug should be reopened.
> 

There were definite improvements in 3.5.  If you are still have signficant performance problems, please open a new bug with a description of your workspace setup and what aspects of the dialog are slow (opening, switching tabs, editing specific tabs, etc.)