Project: SWT
Bug 310932 Poor table scrolling performance on motif aix ppc platform due to multiple XQueryColor calls per widget
Reported: 2010-04-28 19:18:32 | Status: resolved fixed

Build Identifier: 20090619-0625 Using the OpenText's (www.opentext.com) remote connection technology called ExceedOnDemand, we run an eclipse rcp application which has scroll performance problems (15-30 seconds on a 5000 row table) which make it unusable. Even natively, the performance is much slower than linux/gtk. After analyzing some traces, the OpenText developers had the following comments: 1. QueryColors is being called far too often. I dug into the SWT code, and this is arguably a bug in SWT. Please open a bug report against SWT and try to get them to fix it -- at the very least, they should be caching XQueryColor replies instead of calling a fresh XQueryColor (two, actually) per widget (table cell in this case). 2. XSync is also being called too often, but it's not as bad as QueryColors. Again, SWT/Motif only. Any chance of Reproducible: Always Steps to Reproduce: 1. Create a plugin project - Eclipse 3.5 - create an RCP application - choose RCP application with view template 2. Replace the View.java with the class at the end of this description to create a large table 3. Run and compare scroll performance between motif/ppc and linux/gtk The performance gets even worse when remote technology is capturing the graphics commands and scroll performance is 15x worse due to the multiple XQueryColor calls. Code for View.java: package swtexample; import org.eclipse.jface.viewers.IStructuredContentProvider; import org.eclipse.jface.viewers.ITableLabelProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.ui.part.ViewPart; public class View extends ViewPart { public static final String ID = "swtexample.view"; private TableViewer viewer; private int rows = 6000; private int columns = 50; /** * The content provider class is responsible for providing objects to the * view. It can wrap existing objects in adapters or simply return objects * as-is. These objects may be sensitive to the current input of the view, * or ignore it and always show the same content (like Task List, for * example). */ class ViewContentProvider implements IStructuredContentProvider { public void inputChanged(Viewer v, Object oldInput, Object newInput) { } public void dispose() { } public Object[] getElements(Object parent) { String[][] data = new String[rows][columns]; for (int r = 0; r < rows; r++) { for (int c = 0; c < columns; c++) { String rowText = new Integer(r).toString(); String columnText = new Integer(c).toString(); data[r][c]=new String("dataForRow"+rowText+"AndColumn"+columnText); } } return data; } } class ViewLabelProvider extends LabelProvider implements ITableLabelProvider { public String getColumnText(Object obj, int index) { Object[] o; if (obj instanceof Object[]) { o = (Object[]) obj; Object singleO = (String) o[index]; return getText(singleO); } return getText(obj); } public Image getColumnImage(Object obj, int index) { return getImage(obj); } public Image getImage(Object obj) { return null; // return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_ELEMENT); } } /** * This is a callback that will allow us to create the viewer and initialize * it. */ public void createPartControl(Composite parent) { viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); for (int i = 0; i < columns; i++) { TableColumn tableColumn = new TableColumn(viewer.getTable(), SWT.LEFT); tableColumn.setText("Column "+i); tableColumn.setWidth(100); } viewer.getTable().setLinesVisible(true); viewer.getTable().setHeaderVisible(true); viewer.setContentProvider(new ViewContentProvider()); viewer.setLabelProvider(new ViewLabelProvider()); viewer.setInput(getViewSite()); } /** * Passing the focus request to the viewer's control. */ public void setFocus() { viewer.getControl().setFocus(); } } 3.

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/Table.java bundles/org.eclipse.swt/Eclipse SWT/emulated/treetable/org/eclipse/swt/widgets/Tree.java