Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Performance of setItemCount in SWT Tree
Performance of setItemCount in SWT Tree [message #479023] Sat, 08 August 2009 09:19 Go to next message
Eclipse UserFriend
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
Re: Performance of setItemCount in SWT Tree [message #480544 is a reply to message #479023] Mon, 17 August 2009 14:52 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Hi, sorry for the late response,

If you put a System.out.println("hi") in your handleEvent() method do you
see it being invoked for all of the items immediately? And which platform
do you see this on? A SWT.VIRTUAL Tree should have similar performance to a
SWT.VIRTUAL Table.

Grant


"Tom Shackell" <tom-public@shackell.org.uk> wrote in message
news:h5jgdr$s03$1@build.eclipse.org...
> 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
>
>
Previous Topic:SWTException Graphic is disposed on FieldDecoration image during tests
Next Topic:Jface Changes from Europa to Galileo
Goto Forum:
  


Current Time: Fri Apr 26 06:49:23 GMT 2024

Powered by FUDForum. Page generated in 0.04150 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top