Bug 26986 - [Dialog] Must check if goto resource dialog scales.
Summary: [Dialog] Must check if goto resource dialog scales.
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P2 major (vote)
Target Milestone: 2.1 M5   Edit
Assignee: Lynne Kues CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on: 27948
Blocks:
  Show dependency tree
 
Reported: 2002-11-22 12:27 EST by Eduardo Pereira CLA
Modified: 2003-01-28 18:26 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eduardo Pereira CLA 2002-11-22 12:27:37 EST
We must check if the goto/open resource dialog scale. I.E. test it with a 
workspace 10 to 20 times bigger then normal. How long does the user have to 
wait if the workspace has a lot of files.
Comment 1 Nick Edgar CLA 2002-12-09 10:44:53 EST
Should check using the big workspace at:
http://www.eclipse.org/eclipse/development/performance/
Comment 2 Nick Edgar CLA 2002-12-09 10:45:25 EST
Should also avoid populating the list until a prefix has been entered, as with 
Open Type.
Comment 3 Nick Edgar CLA 2002-12-09 10:49:17 EST
John recently made some improvements to marker retrieval performance which we 
might be able to exploit.  Basically it still visits each element in the 
workspace, but avoids creating path or resource objects for each element, only 
the ones that match.  It would be good if the Core support for this was made 
available as API, and was general enough to allow prefix and/or pattern 
matching on the simple name of a resource.
Comment 4 John Arthorne CLA 2002-12-09 11:08:41 EST
I have created bug 27948 for potential new core API to make this faster.  It
would be interesting to know what information you would need for this case.  The
less information we provide, the faster it would be.
Comment 5 Lynne Kues CLA 2002-12-24 11:23:57 EST
Tried to use the big workspace, but was unable to get it to start (kept getting 
select JRE dialog).  

Have experimented with the following:
- change the code to only match when a pattern actually exists (i.e., do not 
return all resources if no string is entered)
- changed the case where no '?''s used and only one '*'s exists at end of match 
string to use a binary search to get the matches

This makes things zippier.  Performance is comparable to 
OpenTypeSelectionDialog for the above case.  

The code needs to be profiled to see where the time is being spent.  I think it 
is in the matching, not the initial sorting/creation of resource descriptors, 
so it may be that the core PR would not be as helpful as expected.
Comment 6 Lynne Kues CLA 2003-01-06 17:03:25 EST
Released changes for the items I mention above.  Did do some profiling, but it 
was hard to pinpoint what was taking long during the Open Resource operation 
due to all the other background stuff that is going on (e.g., java reconciling, 
label decorators, etc.).  

Leaving open in order to further investigate the filtering mechanism that Open 
Type is using.  
Comment 7 Lynne Kues CLA 2003-01-17 10:22:33 EST
Tried using the "fast visitor" given the current design of the 
OpenResourceDialog, which sorts the resources up front.  For this approach the 
path of the resource is needed so that it can be instantiated when it gets 
displayed in the dialog (i.e., need to get the resource image - at which point 
the real resource is needed, not some lightweight version of it) and when it 
gets selected (i.e., so parents can be displayed and/or it can be returned when 
the dialog is closed).  Based on my timings it actually takes longer to use the 
resource visitor in this instance.  

Investigate using the fast visitor everytime the person types a character 
(i.e., no longer sort the resources up front).

Observations about time issues:

- Opening the dialog currently using big workspace takes about 1.5 seconds
- Typing a complex match string (one that cannot take advantage of the sorted 
resource list) is pretty unresponsive.  The dialog updates one at a time in 
spurts.  The behavior is much less responsive than the OpenType dialog for the 
scenario.
- A large part of the time spent when typing a character is updating the 
dialog.  Majority of the time is spent in Object.wait, due to syncExec.  This 
is the same case with the OpenType dialog when typing, but as indicated 
OpenType dialog seems more responsive for complex match case.  It may be that 
it just has less items to look at.  Need to investigate this.

Comment 8 Lynne Kues CLA 2003-01-22 16:06:59 EST
Note, there is a functional reason to have all the items sorted ahead of time - 
it allows "smooth" filling of the matches list.  If all items are not sorted 
from the onset, as the match operation occurs items will be added to the 
list "out of order" which will look odd and which will lead to jumpiness of the 
list/scrollbar (as things are added randomly to the list).

I did track down why the dialog is less responsive than the 
OpenTypeSelectionDialog.  The OpenTypeSelectionDialog subclasses the 
TwoPaneElementSelection dialog, which uses a FilteredList, which updates the 
table and/or matches quicker.   Did try subclassing ResourceListSelectionDialog 
from TwoPaneElementSelection dialog and response for updating the matches list 
as one types is better.  This approach also requires much less code (most of 
what the ResourceListSelectionDialog does is handled by 
TwoPaneElementSelection).

Still, per NE, looked into using fast visitor to get the matches and then 
sorting the matches each time the user types a character.  Response time seems 
acceptable with big workspace.  If the pattern string is a "derivative" of the 
previous pattern string, I use the existing matching resources for matching 
with the new pattern string.  So entire workspace is not necessarily visited on 
each keystroke.  
Comment 9 Lynne Kues CLA 2003-01-22 16:07:53 EST
Released changes in build > 20030122.
Comment 10 Eduardo Pereira CLA 2003-01-23 09:56:37 EST
What about keeping that list after the dialog is opened and update it with a 
resource change listener? So the second time the dialog is opened it will be 
faster.
Comment 11 Lynne Kues CLA 2003-01-23 10:08:23 EST
Keeping the list would still cause a delay the first time the dialog opens, but 
that's how OpenType works,  The approach would also require more memory in the 
big workspace case.  I think the approach Nick suggested is acceptable.  Did 
you try the new code in big workspace?

Anyway, I think the performance was improved and I need to focus on other 
things at this point.  If you want to reopen the bug report, go ahead, but I'm 
not planning on doing anything more on this for M5.
Comment 12 John Arthorne CLA 2003-01-23 10:35:21 EST
If this is revisited in the future, keep in mind there is a space overhead with
maintaining a separate list of every resource in the workspace.  Each resource
handle uses about 70 bytes of space over what is maintained by the core resource
tree.  As it is now, every time I open this dialog, memory usage jumps by a
couple of megs.  Watch mem usage in the task manager when you open this dialog a
dozen times on windows.  

To make this dialog *really* efficient, you'd have to avoid creating IResource
handles completely.  All this dialog needs is the simple name (a String, which
core already maintains), and an image (most of which are duplicates).  It should
be possible to have *very* low space overhead for this dialog.  Note you can
obtain the image for a file name without creating a resource handle using
IEditorRegistry.getmageDescriptor(String name).
Comment 13 Lynne Kues CLA 2003-01-23 14:22:32 EST
Changes break JDT.  Backing out changes.  Need to get with JDT to see how we 
can use fast visitor for their case.  They are doing more filtering than just 
IResource.type and pattern string.

Changes for the faster dialog are as follows:

GotoResourceAction 1.4
GotoResourceDialog 1.5
OpenResourceDialog 1.3
OpenWorkspaceFileAction 1.4
ResourceListSelectionDialog 1.4



Comment 14 Lynne Kues CLA 2003-01-23 15:34:46 EST
When put changes back in, make sure folder list sorted correctly.  NE tried out 
new code and noticed that folder list is sorted in reverse order.
Comment 15 Lynne Kues CLA 2003-01-24 11:01:05 EST
If we go with hybrid approach for jdt, need a wait cursor.
Comment 16 Lynne Kues CLA 2003-01-27 09:51:54 EST
Waiting on [Bug 30274] for a solution for JDT.
Comment 17 Lynne Kues CLA 2003-01-28 18:26:05 EST
Released hybrid solution.  Fixed folder sort problem.