Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Performance of setItemCount in SWT Tree
Performance of setItemCount in SWT Tree [message #479029] Sat, 08 August 2009 07:12 Go to previous message
Eclipse User
Originally posted by: tom-public.shackell.org.uk

Hi,

I've been trying to create a virtual tree that can view very large
trees, with a large number of root items. However, I'm finding that
setItemCount is taking a very long time to execute, even if the items
aren't currently being viewed. This is on the WIN32 platform.

I've followed the approach described at:

http://www.eclipse.org/articles/Article-SWT-Virtual/Virtual- in-SWT.html

Here is the code I am using:

tree = new Tree(parent, SWT.VIRTUAL | SWT.BORDER);
tree.addListener(SWT.SetData, new Listener() {
@Override
public void handleEvent(Event event) {
TreeItem item = (TreeItem) event.item;
String name = "Item " + event.index;
item.setText(name);
}
});

long begin = System.currentTimeMillis();
tree.setItemCount(70000);
long end = System.currentTimeMillis();
System.out.println("Set item count took "+(end-begin)+" ms");

Typical times I am getting for running setItem count are upwards of 30
seconds, it seems that the even though the tree is virtual setItemCount
is creating all the items in one go.

Interestingly if I use a Table rather than a tree then there are no
performance issues at all. However, although this little snippet is
actually flat, in the actual final program the data will be a tree
(albeit a very long flat tree, with lots of roots).

So I was wondering whether anyone knew whether this is a known problem,
and whether there was any workaround to allow the use of large trees?


Thanks


Tom

------------------------------------------------------------ ------------
Cross posted from eclipse.platform.jface, after looking at it closely
this query isn't actually jface specific so I've reposted on the SWT list.
------------------------------------------------------------ ------------
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:Drag and drop feedback for Table widget
Next Topic:SWT Label with SWT.WRAP and SWT.CENTER is wrapped, but not centered (Mac OS X)
Goto Forum:
  


Current Time: Thu May 23 14:31:39 EDT 2013

Powered by FUDForum. Page generated in 0.02341 seconds