Bug 31592 - Plugin import does two operations
Summary: Plugin import does two operations
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.0 M8   Edit
Assignee: Wassim Melhem CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2003-02-11 16:24 EST by John Arthorne CLA
Modified: 2004-02-25 21:24 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Arthorne CLA 2003-02-11 16:24:48 EST
Build: I20030206 (2.1 M5)

The plugin import operation (defined in PluginImportWizard.getImportOperation),
runs two separate workspace runnables.  This means there is a notification phase
in the middle of the import (you can see the navigator update if it's in the
background).  This kicks off activity in the java indexing thread, and so the
remainder of the operation takes much longer because it is fighting for CPU and
various locks with the JDT indexing thread.  When profiling, I noticed that
typical core API calls from within the first operation (PluginImportOperation),
were much faster than calls from within the update classpath operation, due to
the differing CPU contention.

Wrapping this entire process in a single workspace runnable would make this more
efficient, and should speed up the import.  You can use the convenience class
WorkspaceModifyDelegatingOperation to wrap your current IRunnableWithProgress
into a workspace operation.
Comment 1 John Arthorne CLA 2003-02-11 16:48:04 EST
Incidentally, the profiler also showed about 12% of import time was in
WorkspaceModelManager.validate.  It is validating that all plugin projects still
exist for every dependency that gets added (results in > 1000 validations when
importing 15 plugins).  I recall this was added to workaround a bug in the
resource deltas (bug 11956), which has been fixed.  Perhaps this can now be removed?

(Side note: Jeff asked me to sniff around for performance problems, but feel
free to defer until after 2.1 if you're not comfortable making changes this late).
Comment 2 Dejan Glozic CLA 2003-02-11 17:36:46 EST
Import operation is indeed separate from classpath computation. We want the 
Java model to do its work between the two because we want classpath computation 
to see the new situation in the workspace. Our classpath routines are adaptive 
i.e. they produce different results depending on whether a certain plug-in is 
represented as a java project in the workspace or as an external plug-in in the 
target platform. For this to work, Java model must digest the new projects that 
have just been imported, and that will not happen unless it receives resource 
change notification.

We feel more comfortable with validation, but we can see if we can temporary 
turn the validation off when we know we will access the manager many times in 
the loop.

Wassim, investigate if we can add 'setValidationEnabled(boolean)' on the 
workspace model manager and use it to validate at the beginning of an operation 
in which the manager will be accessed many times but no data will be changed to 
warrant re-validation.
Comment 3 Wassim Melhem CLA 2003-03-03 02:00:19 EST
The import operation needs to be a two-step process for accurate classpath 
computation.
The only problem that needs to be addressed is the excessive validation.
Too risky to do it now.
Defer to 2.2
Comment 4 Wassim Melhem CLA 2004-02-22 17:27:18 EST
Reopening to address the inefficiency in Workspace model manager.

Workspace model manager is certainly doing a lot of unnecessary work, and will 
be addressed as part of the whole model revamping currently being done.

As for the double import operations, it will be addressed as part of the 
solution of bug 48368
Comment 5 Wassim Melhem CLA 2004-02-25 21:24:37 EST
Fixed.