Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Performance problems with large layouts in RCP application
Performance problems with large layouts in RCP application [message #1822674] Wed, 11 March 2020 09:25 Go to next message
Julia Kurde is currently offline Julia KurdeFriend
Messages: 91
Registered: November 2011
Location: Berlin, Germany
Member
Hello,

I'm having some performance problems using large layouts in an RCP application. Consider the following layout snippet:
package test01.test;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class MyLayout {

	public static void main (String [] args) {
		Display display = new Display ();
		Shell shell = new Shell (display);
		shell.setLayout(new FillLayout());
		
		Point size = new Point(2550, 7200);
		
		ScrolledComposite sc = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL);
		sc.setLayout (new FillLayout());
		
		Composite content = new Composite(sc, SWT.NONE);
		content.setLayout(new FormLayout());

		int n = 830;
		int w = size.x - 100;
		int h = size.y - 100;

		FormData data;
		Text text;
		Label label;
		for (int i=0; i<n; i++) {
			text = new Text (content, SWT.BORDER);
			text.setText ("value " + i);
			data = new FormData ();
			data.left = new FormAttachment(0, (int) (Math.random()*w));
			data.top = new FormAttachment(0, (int) (Math.random()*h));
			text.setLayoutData (data);
			if (i < 540) {
				label = new Label(content, SWT.BORDER);
				label.setText("dim");
				data = new FormData ();
				data.bottom = new FormAttachment(text, 0, SWT.BOTTOM);
				data.left = new FormAttachment(text, 0, SWT.RIGHT);
				label.setLayoutData(data);
			}
		}
		
		content.setSize(size);
		sc.setContent(content);
		
		shell.setSize(800, 600);
		shell.open ();

		while (!shell.isDisposed ()) {
			if (!display.readAndDispatch ())
				display.sleep ();
		}
		display.dispose ();
	}	
}

This layout has a size of 2550 x 7200 pixels and contains about 1300 children.

When this snipped is run as it is, independent of any RCP application there is no problem.

But if an editor in an RCP application is showing this layout it is extremely slow: it takes several seconds to open, it freezes when it is scrolled and when switching between editors it can even cause the whole application to hang itself.

Where I tested this layout so far:

* 3.x RCP in Eclipse for RCP and RAP Developers
Indigo Service Release 2, Build id: 20120216-1857
=> No Problem

* 3.x RCP in Eclipse for RCP and RAP Developers
2019-09 R (4.13.0), Build id: 20190917-1200
=> slow as described above

* 4.x RCP in Eclipse for RCP and RAP Developers
2019-09 R (4.13.0), Build id: 20190917-1200
=> slow as described above

These RCP applications are based on the corresponding Examples available in the New Project Wizard.

So obviously there are some changes between the Eclipse version from 2012 and 2019 (in between versions not tested), and the question is:

What could cause this performance problem and is there a way to improve it?

I'm happy about any ideas!
Julia

PS: In real live this layout represents a schematic drawing having labels for certain values like temperatures, status messages etc. The above layout just shows a simplified generic example.


Re: Performance problems with large layouts in RCP application [message #1822915 is a reply to message #1822674] Mon, 16 March 2020 16:33 Go to previous message
Rolf Theunissen is currently offline Rolf TheunissenFriend
Messages: 260
Registered: April 2012
Senior Member
The question is repeated and answered in:
https://www.eclipse.org/forums/index.php/m/1822913/
Previous Topic:How to change the language of Minimize/Maximize button in a PartStack?
Next Topic:Branding - Window Images not showing
Goto Forum:
  


Current Time: Fri Apr 19 23:03:22 GMT 2024

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

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

Back to the top