Remove items from SWT tables

Posted by Dima on Stack Overflow See other posts from Stack Overflow or by Dima
Published on 2010-04-20T21:28:44Z Indexed on 2010/04/20 21:33 UTC
Read the original article Hit count: 234

Filed under:
|

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 :)

© Stack Overflow or respective owner

Related posts about swt

Related posts about eclipse-rcp