Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Virtual Table Slow
Virtual Table Slow [message #437303] Wed, 02 June 2004 21:05 Go to next message
Chris Longfield is currently offline Chris LongfieldFriend
Messages: 111
Registered: July 2009
Senior Member
HI,
I am using a virtual table, I thought in the same way as the snippet:

http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-swt-home/snippits/snippet144.html

But when I open the editor that contains the table, everything slows down quite
a bit. The table displays after the snippet below reports the the first 2000
rows populated, but it continues to call handleEvent, and is sucking up CPU.
Should it be doing this even though these rows are not visible?

Also, the performance degrades with time; the first items are taking 3 seconds
per thousand rows. By the time it is halfway done it is taking 15 seconds per
1000 rows. I have checked and the perfomance degredation is coming form outside
the handleEvent method (if I return immediately, it still takes longer and
longer to call handleEvent 1000 times).

A Bizarre effect: If I add a fourth row and call item.setText(3, "Item "+index);
_I can scroll down to the 133700th row and see "Item 133700" immediately_, but
my logger shows I have not processed those rows yet: in fact it still plods
along printing "Getting item 50000", "Getting item 51000" every second or so -
some threading issue I assume? But if Item 133700 is set, why are these events
continuing to be generated?

Here is a snippet from what I am doing:

final Table table = new Table(parent, SWT.V_SCROLL | SWT.VIRTUAL | SWT.H_SCROLL);

final RouteModel model = ((RouteModel)getEditorInput());

table.addListener (SWT.SetData, new Listener () {
public void handleEvent (Event event) {
TableItem item = (TableItem) event.item;
int index = table.indexOf (item);
PrefixNextHop hop = model.getPrefixNextHops()[index];
item.setText (0, hop.getPrefix().toString());
item.setText(1, hop.getNextHopA());
item.setText(2, hop.getNextHopB());
if (index % 1000 ==0 ) {
LOGGER.warn("Getting item "+index);
}
}
});

String [] columns = {"Prefix" , "Next Hop A", "Next Hop B"};

table.setHeaderVisible(true);

for (int i = 0; i < columns.length; i++) {
TableColumn col = new TableColumn(table, SWT.LEFT);
col.setText(columns[i]);
col.setResizable(true);
col.setWidth(100);
}

// triggers the filling in of the table - is this the problem?
table.setItemCount(model.getPrefixNextHops().length);
Re: Virtual Table Slow [message #437377 is a reply to message #437303] Thu, 03 June 2004 13:09 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Are you running on GTK? GTK has a bug that they ask your for table items
when they shouldn't. It is fixed in newer versions of GTK. Please enter a
problem report hacking the SWT snippet to show the problem. How many items
are you putting in the table?

"Chris Longfield" <clongfield@internap.com> wrote in message
news:c9lf00$41h$1@eclipse.org...
> HI,
> I am using a virtual table, I thought in the same way as the snippet:
>
>
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-swt-home/snippits/snippet144.html
>
> But when I open the editor that contains the table, everything slows down
quite
> a bit. The table displays after the snippet below reports the the first
2000
> rows populated, but it continues to call handleEvent, and is sucking up
CPU.
> Should it be doing this even though these rows are not visible?
>
> Also, the performance degrades with time; the first items are taking 3
seconds
> per thousand rows. By the time it is halfway done it is taking 15 seconds
per
> 1000 rows. I have checked and the perfomance degredation is coming form
outside
> the handleEvent method (if I return immediately, it still takes longer and
> longer to call handleEvent 1000 times).
>
> A Bizarre effect: If I add a fourth row and call item.setText(3, "Item
"+index);
> _I can scroll down to the 133700th row and see "Item 133700" immediately_,
but
> my logger shows I have not processed those rows yet: in fact it still
plods
> along printing "Getting item 50000", "Getting item 51000" every second or
so -
> some threading issue I assume? But if Item 133700 is set, why are these
events
> continuing to be generated?
>
> Here is a snippet from what I am doing:
>
> final Table table = new Table(parent, SWT.V_SCROLL | SWT.VIRTUAL |
SWT.H_SCROLL);
>
> final RouteModel model = ((RouteModel)getEditorInput());
>
> table.addListener (SWT.SetData, new Listener () {
> public void handleEvent (Event event) {
> TableItem item = (TableItem) event.item;
> int index = table.indexOf (item);
> PrefixNextHop hop = model.getPrefixNextHops()[index];
> item.setText (0, hop.getPrefix().toString());
> item.setText(1, hop.getNextHopA());
> item.setText(2, hop.getNextHopB());
> if (index % 1000 ==0 ) {
> LOGGER.warn("Getting item "+index);
> }
> }
> });
>
> String [] columns = {"Prefix" , "Next Hop A", "Next Hop B"};
>
> table.setHeaderVisible(true);
>
> for (int i = 0; i < columns.length; i++) {
> TableColumn col = new TableColumn(table, SWT.LEFT);
> col.setText(columns[i]);
> col.setResizable(true);
> col.setWidth(100);
> }
>
> // triggers the filling in of the table - is this the problem?
> table.setItemCount(model.getPrefixNextHops().length);
Re: Virtual Table Slow [message #437392 is a reply to message #437377] Thu, 03 June 2004 16:38 Go to previous messageGo to next message
Chris Longfield is currently offline Chris LongfieldFriend
Messages: 111
Registered: July 2009
Senior Member
Steve Northover wrote:
> Are you running on GTK? GTK has a bug that they ask your for table items
> when they shouldn't. It is fixed in newer versions of GTK. Please enter a
> problem report hacking the SWT snippet to show the problem. How many items
> are you putting in the table?
>


1) A problem report against SWT?
2) 134000 items
3) Which GTK version is new enough?
4) It sounds like this is not an issue with other OS'es/windowing systems, correct?

Thanks,
Chris


> "Chris Longfield" <clongfield@internap.com> wrote in message
> news:c9lf00$41h$1@eclipse.org...
>
>>HI,
>> I am using a virtual table, I thought in the same way as the snippet:
>>
>>
>
> http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-swt-home/snippits/snippet144.html
>
>>But when I open the editor that contains the table, everything slows down
>
> quite
>
>>a bit. The table displays after the snippet below reports the the first
>
> 2000
>
>>rows populated, but it continues to call handleEvent, and is sucking up
>
> CPU.
>
>>Should it be doing this even though these rows are not visible?
>>
>>Also, the performance degrades with time; the first items are taking 3
>
> seconds
>
>>per thousand rows. By the time it is halfway done it is taking 15 seconds
>
> per
>
>>1000 rows. I have checked and the perfomance degredation is coming form
>
> outside
>
>>the handleEvent method (if I return immediately, it still takes longer and
>>longer to call handleEvent 1000 times).
>>
>>A Bizarre effect: If I add a fourth row and call item.setText(3, "Item
>
> "+index);
>
>>_I can scroll down to the 133700th row and see "Item 133700" immediately_,
>
> but
>
>>my logger shows I have not processed those rows yet: in fact it still
>
> plods
>
>>along printing "Getting item 50000", "Getting item 51000" every second or
>
> so -
>
>>some threading issue I assume? But if Item 133700 is set, why are these
>
> events
>
>>continuing to be generated?
>>
>>Here is a snippet from what I am doing:
>>
>>final Table table = new Table(parent, SWT.V_SCROLL | SWT.VIRTUAL |
>
> SWT.H_SCROLL);
>
>>final RouteModel model = ((RouteModel)getEditorInput());
>>
>>table.addListener (SWT.SetData, new Listener () {
>> public void handleEvent (Event event) {
>>TableItem item = (TableItem) event.item;
>>int index = table.indexOf (item);
>> PrefixNextHop hop = model.getPrefixNextHops()[index];
>>item.setText (0, hop.getPrefix().toString());
>>item.setText(1, hop.getNextHopA());
>>item.setText(2, hop.getNextHopB());
>>if (index % 1000 ==0 ) {
>> LOGGER.warn("Getting item "+index);
>>}
>> }
>> });
>>
>>String [] columns = {"Prefix" , "Next Hop A", "Next Hop B"};
>>
>>table.setHeaderVisible(true);
>>
>>for (int i = 0; i < columns.length; i++) {
>>TableColumn col = new TableColumn(table, SWT.LEFT);
>>col.setText(columns[i]);
>>col.setResizable(true);
>>col.setWidth(100);
>> }
>>
>>// triggers the filling in of the table - is this the problem?
>>table.setItemCount(model.getPrefixNextHops().length);
>
>
>
Re: Virtual Table Slow [message #437398 is a reply to message #437392] Thu, 03 June 2004 17:43 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
1) Yes, even though it's a "feature/bug" in GTK if you include the code, we
can benchmark it and try to make it faster.
2) 134000 isn't much. How fast is your machine?
3) GTK 2.3.2 or greater
4) Only an issue on GTK.

"Chris Longfield" <clongfield@internap.com> wrote in message
news:40BF53ED.20006@internap.com...
> Steve Northover wrote:
> > Are you running on GTK? GTK has a bug that they ask your for table
items
> > when they shouldn't. It is fixed in newer versions of GTK. Please
enter a
> > problem report hacking the SWT snippet to show the problem. How many
items
> > are you putting in the table?
> >
>
>
> 1) A problem report against SWT?
> 2) 134000 items
> 3) Which GTK version is new enough?
> 4) It sounds like this is not an issue with other OS'es/windowing systems,
correct?
>
> Thanks,
> Chris
>
>
> > "Chris Longfield" <clongfield@internap.com> wrote in message
> > news:c9lf00$41h$1@eclipse.org...
> >
> >>HI,
> >> I am using a virtual table, I thought in the same way as the snippet:
> >>
> >>
> >
> >
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-swt-home/snippits/snippet144.html
> >
> >>But when I open the editor that contains the table, everything slows
down
> >
> > quite
> >
> >>a bit. The table displays after the snippet below reports the the first
> >
> > 2000
> >
> >>rows populated, but it continues to call handleEvent, and is sucking up
> >
> > CPU.
> >
> >>Should it be doing this even though these rows are not visible?
> >>
> >>Also, the performance degrades with time; the first items are taking 3
> >
> > seconds
> >
> >>per thousand rows. By the time it is halfway done it is taking 15
seconds
> >
> > per
> >
> >>1000 rows. I have checked and the perfomance degredation is coming form
> >
> > outside
> >
> >>the handleEvent method (if I return immediately, it still takes longer
and
> >>longer to call handleEvent 1000 times).
> >>
> >>A Bizarre effect: If I add a fourth row and call item.setText(3, "Item
> >
> > "+index);
> >
> >>_I can scroll down to the 133700th row and see "Item 133700"
immediately_,
> >
> > but
> >
> >>my logger shows I have not processed those rows yet: in fact it still
> >
> > plods
> >
> >>along printing "Getting item 50000", "Getting item 51000" every second
or
> >
> > so -
> >
> >>some threading issue I assume? But if Item 133700 is set, why are these
> >
> > events
> >
> >>continuing to be generated?
> >>
> >>Here is a snippet from what I am doing:
> >>
> >>final Table table = new Table(parent, SWT.V_SCROLL | SWT.VIRTUAL |
> >
> > SWT.H_SCROLL);
> >
> >>final RouteModel model = ((RouteModel)getEditorInput());
> >>
> >>table.addListener (SWT.SetData, new Listener () {
> >> public void handleEvent (Event event) {
> >>TableItem item = (TableItem) event.item;
> >>int index = table.indexOf (item);
> >> PrefixNextHop hop = model.getPrefixNextHops()[index];
> >>item.setText (0, hop.getPrefix().toString());
> >>item.setText(1, hop.getNextHopA());
> >>item.setText(2, hop.getNextHopB());
> >>if (index % 1000 ==0 ) {
> >> LOGGER.warn("Getting item "+index);
> >>}
> >> }
> >> });
> >>
> >>String [] columns = {"Prefix" , "Next Hop A", "Next Hop B"};
> >>
> >>table.setHeaderVisible(true);
> >>
> >>for (int i = 0; i < columns.length; i++) {
> >>TableColumn col = new TableColumn(table, SWT.LEFT);
> >>col.setText(columns[i]);
> >>col.setResizable(true);
> >>col.setWidth(100);
> >> }
> >>
> >>// triggers the filling in of the table - is this the problem?
> >>table.setItemCount(model.getPrefixNextHops().length);
> >
> >
> >
Re: Virtual Table Slow [message #437400 is a reply to message #437398] Thu, 03 June 2004 17:56 Go to previous message
Chris Longfield is currently offline Chris LongfieldFriend
Messages: 111
Registered: July 2009
Senior Member
Steve Northover wrote:
> 1) Yes, even though it's a "feature/bug" in GTK if you include the code, we
> can benchmark it and try to make it faster.
> 2) 134000 isn't much. How fast is your machine?

800 MHz/640MB

> 3) GTK 2.3.2 or greater
> 4) Only an issue on GTK.
>
> "Chris Longfield" <clongfield@internap.com> wrote in message
> news:40BF53ED.20006@internap.com...
>
>>Steve Northover wrote:
>>
>>>Are you running on GTK? GTK has a bug that they ask your for table
>
> items
>
>>>when they shouldn't. It is fixed in newer versions of GTK. Please
>
> enter a
>
>>>problem report hacking the SWT snippet to show the problem. How many
>
> items
>
>>>are you putting in the table?
>>>
>>
>>
>>1) A problem report against SWT?
>>2) 134000 items
>>3) Which GTK version is new enough?
>>4) It sounds like this is not an issue with other OS'es/windowing systems,
>
> correct?
>
>>Thanks,
>>Chris
>>
>>
>>
>>>"Chris Longfield" <clongfield@internap.com> wrote in message
>>>news:c9lf00$41h$1@eclipse.org...
>>>
>>>
>>>>HI,
>>>> I am using a virtual table, I thought in the same way as the snippet:
>>>>
>>>>
>>>
>>>
> http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-swt-home/snippits/snippet144.html
>
>>>>But when I open the editor that contains the table, everything slows
>
> down
>
>>>quite
>>>
>>>
>>>>a bit. The table displays after the snippet below reports the the first
>>>
>>>2000
>>>
>>>
>>>>rows populated, but it continues to call handleEvent, and is sucking up
>>>
>>>CPU.
>>>
>>>
>>>>Should it be doing this even though these rows are not visible?
>>>>
>>>>Also, the performance degrades with time; the first items are taking 3
>>>
>>>seconds
>>>
>>>
>>>>per thousand rows. By the time it is halfway done it is taking 15
>
> seconds
>
>>>per
>>>
>>>
>>>>1000 rows. I have checked and the perfomance degredation is coming form
>>>
>>>outside
>>>
>>>
>>>>the handleEvent method (if I return immediately, it still takes longer
>
> and
>
>>>>longer to call handleEvent 1000 times).
>>>>
>>>>A Bizarre effect: If I add a fourth row and call item.setText(3, "Item
>>>
>>>"+index);
>>>
>>>
>>>>_I can scroll down to the 133700th row and see "Item 133700"
>
> immediately_,
>
>>>but
>>>
>>>
>>>>my logger shows I have not processed those rows yet: in fact it still
>>>
>>>plods
>>>
>>>
>>>>along printing "Getting item 50000", "Getting item 51000" every second
>
> or
>
>>>so -
>>>
>>>
>>>>some threading issue I assume? But if Item 133700 is set, why are these
>>>
>>>events
>>>
>>>
>>>>continuing to be generated?
>>>>
>>>>Here is a snippet from what I am doing:
>>>>
>>>>final Table table = new Table(parent, SWT.V_SCROLL | SWT.VIRTUAL |
>>>
>>>SWT.H_SCROLL);
>>>
>>>
>>>>final RouteModel model = ((RouteModel)getEditorInput());
>>>>
>>>>table.addListener (SWT.SetData, new Listener () {
>>>> public void handleEvent (Event event) {
>>>>TableItem item = (TableItem) event.item;
>>>>int index = table.indexOf (item);
>>>> PrefixNextHop hop = model.getPrefixNextHops()[index];
>>>>item.setText (0, hop.getPrefix().toString());
>>>>item.setText(1, hop.getNextHopA());
>>>>item.setText(2, hop.getNextHopB());
>>>>if (index % 1000 ==0 ) {
>>>> LOGGER.warn("Getting item "+index);
>>>>}
>>>> }
>>>> });
>>>>
>>>>String [] columns = {"Prefix" , "Next Hop A", "Next Hop B"};
>>>>
>>>>table.setHeaderVisible(true);
>>>>
>>>>for (int i = 0; i < columns.length; i++) {
>>>>TableColumn col = new TableColumn(table, SWT.LEFT);
>>>>col.setText(columns[i]);
>>>>col.setResizable(true);
>>>>col.setWidth(100);
>>>> }
>>>>
>>>>// triggers the filling in of the table - is this the problem?
>>>>table.setItemCount(model.getPrefixNextHops().length);
>>>
>>>
>>>
>
>
Previous Topic:gcj
Next Topic:Tree.showSelection doesn't work
Goto Forum:
  


Current Time: Fri Sep 20 22:03:23 GMT 2024

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

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

Back to the top