Bug 62277 - [Decorators] Updating decorators on expansion can be slow
Summary: [Decorators] Updating decorators on expansion can be slow
Status: CLOSED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux-GTK
: P2 normal (vote)
Target Milestone: 3.0   Edit
Assignee: Tod Creasey CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
: 62278 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-05-14 10:45 EDT by Steve Northover CLA
Modified: 2005-05-10 14:54 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Northover CLA 2004-05-14 10:45:35 EDT
20040506 Linux GTK

SN hacked SWT to print out whenever the UI-thread was took longer than 250ms to
process an event on Windows and GTK. 

When we expand the packages view on GTK we are getting slow times processing the
updates.

STEPS
1) load org.eclipse.swt (CVS decorators are on, .classpath dance etc...)
2) Modify DecoratorManager with the followiung code

	Display.Z = true;
	l.labelProviderChanged(event);
	Display.Z = false;

3) Modify TreeViewer to do the following

protected void doUpdateItem(final Item item, Object element) {
	// update icon and label
	IBaseLabelProvider baseProvider = getLabelProvider();
	if (baseProvider instanceof IViewerLabelProvider) {
		IViewerLabelProvider provider = (IViewerLabelProvider)baseProvider;
		
		ViewerLabel updateLabel = new ViewerLabel(item.getText(), item.getImage());
		if (Display.Z) System.out.println ("\t" + updateLabel);
		
		provider.updateLabel(updateLabel, element);
		
		if(updateLabel.hasNewImage())
			if (!Display.Z) item.setImage(updateLabel.getImage());
		if(updateLabel.hasNewText())
			if (!Display.Z) item.setText(updateLabel.getText());

And then instrument the UIJob to display when times are long.

We are getting about 450ms times on a 2.5 Ghz GTK box (which is not long but the
machine is really fast).  On Windows (also 2.5 Ghz), the decorator code doesn't
come up.

SN says, "The Display.Z hack was used to remove SWT from the equation."
Comment 1 Tod Creasey CLA 2004-05-14 11:44:29 EDT
*** Bug 62278 has been marked as a duplicate of this bug. ***
Comment 2 Tod Creasey CLA 2004-05-14 15:21:47 EDT
Here are some improvements we can make

isExpandable is slow with anything with filters as we are doing 
getFilteredChildren(). We need to add a (private for now) hasFilteredChildren 
method to AbstractTreeViewer to see if we could optimize this. Right now 
updatePlus is about half as long as updateItem which is really not acceptable 
in the PackagesView as the filtering is quitre expensive.

Comment 3 Erich Gamma CLA 2004-05-17 10:17:17 EDT
The JavaCore has implement the hasChildren() method in more places, so this 
optimization should really help. To find out how much we gain, did you compare 
doing the same scenario with and without any filters?
Comment 4 Tod Creasey CLA 2004-05-17 11:08:19 EDT
I have released the optimization to HEAD and I will measure performance 
differences soon (need to get a couple more things sorted for M9 first).
Comment 5 Michael Van Meekeren CLA 2004-05-25 16:40:00 EDT
Please verify that the released improvements have eliminated this problem?
Comment 6 Steve Northover CLA 2004-05-25 16:44:02 EDT
Todd, I can show you where the hacks are to do this.  Can't get to it right 
now.
Comment 7 Tod Creasey CLA 2004-05-28 12:11:55 EDT
I am getting 105ms on my laptop in 20040528 doing the same test. I am trying 
to get an 0506 workspace set up to double check but I am having some troble 
right now.

I will mark as fixed and try to get a better comparison later.
Comment 8 Tod Creasey CLA 2005-05-10 14:54:12 EDT
Marking as closed.