Bug 139798 - [navigation] Ctrl+O should use FilteredTree was: Outline popup slow in OS X
Summary: [navigation] Ctrl+O should use FilteredTree was: Outline popup slow in OS X
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.2   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on: 128233 158279 161400
Blocks:
  Show dependency tree
 
Reported: 2006-05-02 14:46 EDT by Matthew Conway CLA
Modified: 2007-07-29 09:19 EDT (History)
3 users (show)

See Also:


Attachments
project containing concrete example (2.65 KB, application/octet-stream)
2006-05-03 09:33 EDT, Matthew Conway CLA
no flags Details
Quick hack using FilteredTree (4.79 KB, patch)
2006-09-27 04:56 EDT, Dani Megert CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Conway CLA 2006-05-02 14:46:30 EDT
If I pull up the outline popup (Cmd-O) and start typing, it takes anywhere from 5-10 seconds for the typing to complete and the filtering to take effect.  This is on a large class with ~ 200 members - Its not as slow on smaller classes, but still some lag noticeable.


eclipse 3.2RC2 on OS X 10.4.6 java 1.4.2_09
Comment 1 Dani Megert CLA 2006-05-02 16:36:47 EDT
This works for me using large classes like TextLayout.java or JavaEditor.java.

André how's the performance for you?

Matthew, please provide a concrete example.
Comment 2 Andre Weinand CLA 2006-05-02 16:54:24 EDT
On my 2 GHz Dual Core Intel Mac, I don't see any delays...
Comment 3 Matthew Conway CLA 2006-05-03 09:08:53 EDT
My machine is _just_ a Powerbook G4 1.67GHz :)

The delay only happens when the _filtered_ list is large, i.e. a class with many gettters and you type get as the filter text - the g types fast, but the e and the t take a while to appear, and so on if many of the getters have similar names - I have many getD... so the D takes a while to appear too.

Comment 4 Dani Megert CLA 2006-05-03 09:11:54 EDT
From comment 1:
>Matthew, please provide a concrete example.
Comment 5 Matthew Conway CLA 2006-05-03 09:33:07 EDT
Created attachment 40195 [details]
project containing concrete example

Unzip the project, point to it in eclipse, open Baz.java, hit cmd-o, type getme to filter, notice how slow the typed letters appear.
Comment 6 Matthew Conway CLA 2006-05-03 09:33:43 EDT
reopened with concrete example.
Comment 7 Dani Megert CLA 2006-05-03 16:43:01 EDT
I do not have a computer that is as fast as André's and the attach test case works  extremly smooth.

Did you try with fresh Eclipse SDK 3.2 RC2 and fresh workspace?

André, just to double-check: can you give the attached example a try?
Comment 8 Andre Weinand CLA 2006-05-03 17:01:34 EDT
Yes, I can confirm that there is a noticable delay (0.5 sec) between chars on typing "getMe".

(However, it is still 100x more responsive than typing in the SpotLight dialog on Tiger :-)
Comment 9 Andre Weinand CLA 2006-05-03 17:19:50 EDT
I see a much more severe delay when opening the outline on class OS (the Mac SWT natives).
Whenever you type a character that results in a drastic change of filtered TreeItems, the delay is noticable.

IIRC, this is probably the old Mac problem that creating single TreeItems takes way too long.
I could verify this if you (Dani) can show me how to disable the Tree update on typing.
Comment 10 Dani Megert CLA 2006-05-04 03:43:33 EDT
OK, problem seen.
We should switch to use the FilteredTree in 3.2 which should get rid of that problem.
Comment 11 Dani Megert CLA 2006-05-08 09:43:36 EDT
>We should switch to use the FilteredTree in 3.2 which should get rid of that
>problem.
I meant 3.3.
Comment 12 Dani Megert CLA 2006-09-22 06:26:47 EDT
Setting to remind until blocking bugs are fixed.
Comment 13 Karice McIntyre CLA 2006-09-22 10:37:50 EDT
Dani, see my question in bug 133378#c2.
Comment 14 Dani Megert CLA 2006-09-26 12:33:57 EDT
We can now "use" the FilteredTree but run into problems like
- layouting: we add a view menu and have to see how to get the alignment right
- our key listener seems to be overridden/hidden by the one attached to the text
  widget
- we need to change the text widget creation in order to get rid of the border
- in a normal sized scenario the tree filtering now looks slower due to the
  delay

Before we go down this path I'd like to let André test a prototype to see whether switching to the FilteredTree would solve the initial problem reported in comment 0.
Comment 15 Dani Megert CLA 2006-09-26 12:38:10 EDT
- plus we need to add a horizontal separator between the text and the tree
Comment 16 Karice McIntyre CLA 2006-09-26 14:27:23 EDT
1. Are you using filtered tree in a view?  What is it about the alignment that is not right?
2. I didn't anticipate clients to wanting to change the behavior of the listeners - the behavior should be as consistent as possible across all filtered trees.  Is the behavior you want to add something that should be added to all filtered trees?
3. Overriding doCreatefilterText() should resolve this 
4. Performance - see bug 128233 (suggested patches welcome).
5. Does overriding createControl() accomplish this?
Comment 17 Dani Megert CLA 2006-09-27 04:48:26 EDT
Karice, my previous comments were not meant to list problems in the FilteredTree itself but just list the (considerable) work we have to do when we want to switch. I think most of it can be done (the exception being the layouting). I added you because you might be interested to hear how it goes.

>1. Are you using filtered tree in a view?  What is it about the alignment that
is not right?
No, I tried to use it for our Quick Views (e.g.Ctrl+O ) which are PopupDialog's. The thing which is currently almost impossible to do is to put the (private) horizontal line between the text and the tree widget. I'll file a bug report if we decide to go ahead with this PR once we have the performance feedback from André.

>2. I didn't anticipate clients to wanting to change the behavior of the
>listeners - the behavior should be as consistent as possible across all
>filtered trees.  Is the behavior you want to add something that should be added
>to all filtered trees?
No, we add a key listener to the tree and the text widget in order to allow closing the dialog upon ESC and to provide the toggling (you can press Ctrl+O again while it is open to see the inherited members). We just have to attach them to the FilteredTree's widget and should be fine.

>4. Performance - see bug 128233 (suggested patches welcome).
I'll let you know how it compares to our current solution. What worried me more is the fact that it feels slower in general i.e. also when having just a few items.
Comment 18 Dani Megert CLA 2006-09-27 04:56:17 EDT
Created attachment 50990 [details]
Quick hack using FilteredTree

André can you comment on the performance of this patch (compared to comment 9)? It applies to R3.2 and newer.
Comment 19 Dani Megert CLA 2006-10-07 02:53:51 EDT
André?
Comment 20 Andre Weinand CLA 2006-10-08 17:33:55 EDT
I could not get the patch to work because init() is no longer available and doCreateTreeViewer() is called from the constructor of the super class FilteredTree, which makes it hard to set fControl early enough (thus avoiding the NPE).
Comment 21 Dani Megert CLA 2006-10-09 06:21:02 EDT
Using I20061003-0800 I see a FilteredTree.init method but with 2 parameters: (int treeStyle, PatternFilter filter). You can simply remove the unneeded one and it should work.
Comment 22 Andre Weinand CLA 2006-10-09 18:25:15 EDT
Ok, I got this to work.
However, I see very mixed results (on a 2.0G Intel Dual Core Mac Book Pro):
I tested Ctrl+O with SWT carbon's OS class.
Old version:
  typing 'q': filtered result with almost no delay
  typing backspace: 5 second delay until tree is unfiltered again
New version:
  typing 'q': 2.5 seconds delay until filtered result ready
  typing backspace: 0.8 second delay until tree is unfiltered again

Old version:
  typing 'k': 2.5 seconds delay until filtered result ready
  typing backspace: 3 second delay until tree is unfiltered again
New version:
  typing 'k': 2 seconds delay until filtered result ready
  typing backspace: 3 second delay until tree is unfiltered again

So overall the old version seems faster on filtering,
the new version faster on un-filtering.
Comment 23 Dani Megert CLA 2006-10-10 01:57:27 EDT
André, can you also try with a small (or average) sized CU? On WindowsXP I see delays with the new version which results in a worse UI compared to the old one.
Comment 24 Andre Weinand CLA 2006-10-10 04:03:51 EDT
I tried with smaller files and/or I tried typing more than one letter in row.
On Mac the current solution feels more smooth and more responsive so I' suggest to keep using it.
The only thing that works better in the new code is when deleting all characters from the filter so that the Tree has to populate the full tree. 
Comment 25 Dani Megert CLA 2006-10-18 09:05:40 EDT
Pressing the backspace takes that long because
- all items (> 2500) need to be created (about which we can't do much)
  ==> switching to use virtual tree could solve this issue.
- bug 161400
Comment 26 Karice McIntyre CLA 2006-10-18 09:48:33 EDT
Boris, what was the result of using the virtual tree in the large tree viewer example?
Comment 27 Boris Bokowski CLA 2006-10-18 10:54:53 EDT
(In reply to comment #26)
> Boris, what was the result of using the virtual tree in the large tree viewer
> example?

I think the underlying problem is that we call refresh() to refresh the whole tree when the filter text changes.  This is a blocking operation that takes a long time for medium and large trees.  We need a way of refreshing the tree incrementally, in the background.

I ran into a problem with SWT's TreeItem.setExpanded which scrolls to the item that is expanded.  Because of this, my first attempt at making FilteredTree scalable didn't produce useable results, and then I had to focus other things.  But it's still on my to do list.
Comment 28 Karice McIntyre CLA 2006-11-07 10:55:05 EST
You should try the filtered tree again now that Boris has made some performance optimizations to it - see bug 128233.  If you have any comments on the new optimizations put them in that bug.
Comment 29 Boris Bokowski CLA 2006-11-07 11:26:13 EST
Not sure if FilteredTree in its current state is helping much - the main optimization was to not expand elements that are outside of the visible range.  This helps for deep trees, but not for cases like Ctrl-O on classes with many menmbers like OS.java.
Comment 30 Dani Megert CLA 2007-06-22 09:59:31 EDT
Get rid of deprecated state.
Comment 31 Dani Megert CLA 2007-06-22 10:04:44 EDT
.
Comment 32 Eclipse Webmaster CLA 2007-07-29 09:19:44 EDT
Changing OS from Mac OS to Mac OS X as per bug 185991