Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Layouting a large number of draw2d widgets in a Canvas(Draw2d performance degrades when the number of widgets on the Canvas increases)
Layouting a large number of draw2d widgets in a Canvas [message #1064029] Mon, 17 June 2013 06:59 Go to next message
Saurabh Srivastava is currently offline Saurabh Srivastava
Messages: 7
Registered: June 2012
Junior Member
We are facing a problem, in handling a large number of Draw2d Figures, in a single Canvas. We are building a Tree of the nodes, with Connections between a parent, and a child node. The number of figures, in the canvas are of the order of 10000 (just the "Node" Figures, there are about another 10000 "Connection" figures too, that I am not counting).

I am attaching a part of one of our diagrams in Image:
index.php/fa/15286/0/

The problem is this: the nodes in the tree can be collapsed or expanded. When the number of Nodes in the Tree are of the order of 1000-2000, then the Collapse/Expand takes place momentarily. However, when the node count goes higher, it takes more and more time to Collapse/Expand any particular node, which is irritating.

I have written some sample code to see, if the problem is with our code, or, that draw2d performance degrades in general with more number of widgets. The same problem exists within the sample application, which indicates that we may have to do some optimizations within the draw2d codebase itself. I made a View in Eclipse to demonstrate that. The code of the same is attached as an Eclipse RCP Project.

Try to expand/collapse figures in the View (by clicking on the "x" or ">" buttons), it'll take time (won't occur instantaneously). Can anyone please provide some pointers as to how this problem can be solved?

Thanks in advance.
  • Attachment: scd.png
    (Size: 19.98KB, Downloaded 292 times)
  • Attachment: TreeTest.zip
    (Size: 19.17KB, Downloaded 50 times)
Re: Layouting a large number of draw2d widgets in a Canvas [message #1064058 is a reply to message #1064029] Mon, 17 June 2013 09:07 Go to previous messageGo to next message
Jan Krakora is currently offline Jan Krakora
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Hi,

looking at the TreeTest I think the problem is that all nodes have the same parent.
When you do a change in any of the node or its children, the whole branch of the figure tree is revalidated.
So the contentPanel figure layouts all its children (all nodes) and that is very slow.

It's explained much better here.

I'm not sure I'm capable of providing a solution for you. You could separate the tree to rows,
where every row would be an independent Figure with the GridLayout. So when you collapse/expand it, all other rows don't need to revalidate (layout).

You could also experiment with overriding isValidationRoot() method where revalidate chain stops.
Re: Layouting a large number of draw2d widgets in a Canvas [message #1064065 is a reply to message #1064058] Mon, 17 June 2013 09:34 Go to previous messageGo to next message
Saurabh Srivastava is currently offline Saurabh Srivastava
Messages: 7
Registered: June 2012
Junior Member
Hi,

Thanks for the link, it was surely helpful. Yes I know there is no direct solution probably. I'll need to do some experimentation. Thanks for the suggestion. It is bound to be at least as good as what the current application is, performance wise.

I will post my observations here in case they may help anyone else.
Re: Layouting a large number of draw2d widgets in a Canvas [message #1064195 is a reply to message #1064058] Tue, 18 June 2013 04:12 Go to previous message
Saurabh Srivastava is currently offline Saurabh Srivastava
Messages: 7
Registered: June 2012
Junior Member
Hi Jan,

Thanks a lot for the suggestion. The performance has improved significantly, and it will work for now.

If anyone faces a similar situation, it is therefore suggested to "group" figures into higher level figures. This will surely make the layouting much better.

I am also attaching the Sample Modified Code, which compares two approaches, side by side.

Thanks
  • Attachment: TreeTest.zip
    (Size: 33.00KB, Downloaded 51 times)
Previous Topic:Visualize connections when Source and Target(EditParts) are the same.
Next Topic:Layout for multiple IFigure children of a PolylineConnection?
Goto Forum:
  


Current Time: Tue Jul 29 04:54:01 EDT 2014

Powered by FUDForum. Page generated in 0.01930 seconds