Community
Participate
Working Groups
On all Motif: Make a virtual table with two or three columns and 20,000 rows, each cell containing text of length about 20 characters. Use the mouse to increase the width of the first column. The app will hang for close to a full minute. I played with the code a bit and managed to resolve the issue. My change seems to work fine in my app, but I haven't thought about whether it is sufficiently general. Below I have pasted the change I made. The basic idea is the following. In the method Table.updateColumnWidth(), there is a loop that iteratively calls TableItem.updateColumnWidth() for each item in the table. In a virtual table, this will have the effect of filling in the data for every row, which, I think, is causing the slowdown. Instead of this loop, for a virtual table just do a clearAll(). Here is the code: In the method Table.updateColumnWidth() replace for (int i = 0; i < itemsCount; i++) { items [i].updateColumnWidth (column, gc); } gc.dispose (); with if ((style & SWT.VIRTUAL)== 0) { for (int i = 0; i < itemsCount; i++) { items [i].updateColumnWidth (column, gc); } } gc.dispose (); if ((style & SWT.VIRTUAL) != 0) { clearAll(); }
fixed > 0720 The problem was the filling of the full table on the column resize. My test snippet below went from taking ~6 seconds to essentially instantaneous after the fix (perhaps my machine is faster than what you're testing on). If you still see slowness on your end then please reopen the report and attach a snippet like the one below that shows the problem happening, thanks. public class Main { static int counter = 0; public static void main (String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setBounds(10,10,400,400); final Table table = new Table(shell, SWT.VIRTUAL); table.setBounds(10,10,300,300); new TableColumn(table, SWT.NONE).setWidth(100); new TableColumn(table, SWT.NONE).setWidth(100); new TableColumn(table, SWT.NONE).setWidth(100); table.setHeaderVisible(true); table.setItemCount(20000); table.addListener(SWT.SetData, new Listener() { public void handleEvent(Event event) { String thing = counter++ + "abcdefghijklmnopqrstuvwxyz"; System.out.println(thing); ((TableItem)event.item).setText(new String[] {thing, thing, thing}); } }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } }
*sigh* taking ownership first...
marking as FIXED, again
is there any patch for 3.1 to solve this problem there?