Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330943

Summary: [plug-in registry] View initialization takes too much time
Product: [Eclipse Project] PDE Reporter: Wojciech Galanciak <wojciech.galanciak>
Component: UIAssignee: Curtis Windatt <curtis.windatt.public>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: curtis.windatt.public, jacek.pospychala, krzysztof.daniel, pwebster, remy.suen, tjwatson
Version: 3.7Keywords: contributed
Target Milestone: 3.7 M4   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
patch
none
updated patch none

Description Wojciech Galanciak CLA 2010-11-23 12:15:27 EST
Initialization of Plug-in Registry view is very slow, especially when a number of plug-ins is high (e.g. >400).
Comment 1 Wojciech Galanciak CLA 2010-11-23 12:19:54 EST
Created attachment 183684 [details]
patch

This patch increases speed significantly. Here are some results for two different target platforms:

1) 197 plug-ins
Current:
7155
With patch:
648

1) 441 plug-ins
Current:
19535
With patch:
1478

I have tested it and there are not any regression problems.
Comment 2 Curtis Windatt CLA 2010-11-23 12:40:58 EST
Looking at the patch, I found it very surprising to see that the performance difference is so significant.  The search being done in the patch is essentially the same as what is done in the state.  However, it appears that asking the platform admin for the state actually creates a new State each time it is called.  Even though it is based on the current state, the method has to create new bundle descriptions for each bundle.

cc'ing Tom for comment.  It feels like PlatformAdmin should mention in the javadoc that it creates a new state.  

Is there a way to get the cached system state?  I don't see anything wrong with the patch asking the bundle context for the current bundles, but if we have a state, it would be better.
Comment 3 Wojciech Galanciak CLA 2010-11-23 15:17:07 EST
Created attachment 183705 [details]
updated patch

It looks like the problem can be also solved in a different way. Curtis, you are right that method PlatformAdmin.getState() creates new state for each call. The cause we request for a mutable state. If we need to get a state only for reading (in our case) we can call PlatformAdmin.getState(boolean) with false and then we do not create a new state object. I have attached a patch. It makes the same improvement as a previous one.
Comment 4 Curtis Windatt CLA 2010-11-24 14:48:31 EST
Fixed in HEAD.  Thanks for the patch!