Bug 107419 - tree expand much slower than tabletree
Summary: tree expand much slower than tabletree
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Steve Northover CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
: 107418 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-08-19 05:56 EDT by cem CLA
Modified: 2007-02-15 09:19 EST (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 cem CLA 2005-08-19 05:56:04 EDT
this code works ten times slower for tree. (expanding the whole tree)

boolean expand = true/false;
TreeItem[] subItems = treeAccounts.getItems();
for (int k = 0; k < subItems.length; k++) {
	expandTree(subItems[k], expand);
}
..
..
public void expandTree(TreeItem treeItem, boolean expand)
{
	treeItem.setExpanded(expand);
	TreeItem[] subTree = treeItem.getItems();
	for (int k = 0; k < subTree.length; k++)
	{
		expandTree(subTree[k], expand);
	}
}
Comment 1 Billy Biggs CLA 2005-08-19 09:29:54 EDT
*** Bug 107418 has been marked as a duplicate of this bug. ***
Comment 2 Steve Northover CLA 2007-01-09 19:53:34 EST
This is happening because Windows is running animation.
Comment 3 mk CLA 2007-02-15 06:35:47 EST
workaround: expand, collapse (and inserts/removals) are slow for tree. Hide the tree at the start of these events and show it at the end. For the expand event, use the below code (same can be used for SWT.Collapse)

this might be windows-only, so check that the OS==windows before adding the listener.

causes a slight flicker.


tree.addListener(SWT.Expand, new Listener() {

	public void handleEvent(Event event) {
		tree.setVisible(false);
		Display.getCurrent().asyncExec( new Runnable() {
			public void run() {
				tree.setVisible(true);
				tree.forceFocus();
			}
		});
	}
	
});


keywords: swt slow tree expand tree collapse tree animation
Comment 4 Steve Northover CLA 2007-02-15 09:19:12 EST
Seems wrong to me.  The correct platform behavior is to have the animation.  Why not turn it off using the Control Panel instead?