views:

70

answers:

1

This is more of an answer I'd like to share for the problem I was chasing for some time in RCP application using large SWT tables.

The problem is the performance of SWT Table.remove(int start, int end) method. It gives really bad performance - about 50msec per 100 items on my Windows XP. But the real show stopper was on Vista and Windows 7, where deleting 100 items would take up to 5 seconds! Looking into the source code of the Table shows that there are huge amount of windowing events flying around in this call.. That brings the windowing system to its knees.

The solution was to hide the damn thing during this call:

table.setVisible(false);
table.remove(from, to);
table.setVisible(true);

That does wonders - deleting 500 items on both XP & Windows7 takes ~15msec, which is just an overhead for printing out time stamps I used.

nice :)

+1  A: 

Instead of table.setVisible(), you should rather use table.setRedraw(). This method on Control has exactly the purpose of suppressing drawing operations during expensive updates.

ralfstx
yep, it work well too, thanks!
Dima