Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » Virtual TreeViewer + ILazyTreeContentProvider performance
Virtual TreeViewer + ILazyTreeContentProvider performance [message #485026] Thu, 10 September 2009 06:04
Simon Chemouil is currently offline Simon Chemouil
Messages: 24
Registered: July 2009
Junior Member
Hi,

I am currently working on a monitoring application which displays a huge
amount of often refreshed data and have been using the lazy support on
Virtual TreeViewers for that purpose.


I am writing because of a strange performance behavior I am experiencing.

I am using a TreeViewer to group tabular elements given a field, exactly
like in the Problem View in Eclipse IDE.

When I am using the grouped view (Tree of level2 : invisible root >
first level = categories > 2nd level = tabular elements displayed), I
have no performance issue whatsoever.

I am using as an example 10000 elements with 4 fields that are all
changed with random values every 100ms. The model is changed in a non-UI
thread, and the UI is refreshed in the UI thread.. here is a snippet of
code:
// before: changing model in another thread
TimerTask task2 = new TimerTask() {
public void run() {
parent.getDisplay().syncExec(new Runnable() {
public void run() {
/* Refresh every 125ms */
viewer.refresh(false);
}
});

}
};

Timer timer2 = new Timer(true);
timer2.scheduleAtFixedRate(task2, 0, 100);


The problem happens when I get into the "flat" view. For this, I keep
using a TreeViewer but with another implementation of
ILazyTreeContentProvider, however I have 10000 children under the
invisible root.


While the performance of a 2-level lazy virtual TreeViewer is perfect
(even impressive, and fully responsive), when it is the very same but
flattened 1-level lazy virtual TreeViewer I lose most performance (the
UI gets blocked/sluggish).

Here's the replace code in my ILazyTreeContentProvider:

@Override
public void updateElement(Object parent, int index) {
viewer.replace(parent, index, (Variable)vars[index]);
}


I understand the underlying data structures could cause some performance
issues, but when using an Object array I believe the access should be
immediate.

Also, I am on a dual-core machine and the UI thread should not suffer
from model changes outside. As a matter of fact, it does not suffer at
all under the first scenario when my TreeViewer is grouping by column.


I was under the impression that the SWT.VIRTUAL flag +
LazyTreeContentProvider meant that a refresh(false) on the viewer would
only graphically refresh visible elements provided by the replace method
in the content provider, but it looks like it is the case only for 2nd
level children and not for my flattened view.

I have tried the same performance test on a TableViewer but I
experienced another problem of the scrollbar scrolling-up at every
refresh() so I could not compare properly.


I am using Eclipse 3.5 with GTK2 under GNU/Linux 64.


I would greatly appreciate any pointers or hints to solve my performance
problem on the flat view.

Thanks

--
Simon Chemouil
Previous Topic:TableViewer, CellEditors and contextual menu
Next Topic:TableViewerValidation
Goto Forum:
  


Current Time: Sat Jul 26 13:22:55 EDT 2014

Powered by FUDForum. Page generated in 0.02129 seconds