Bug 531145 - [Performance] Creation of elements in a Diagram takes too many time
Summary: [Performance] Creation of elements in a Diagram takes too many time
Status: NEW
Alias: None
Product: Papyrus
Classification: Modeling
Component: Diagram (show other bugs)
Version: 3.3.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Vincent Lorenzo CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 529945
  Show dependency tree
 
Reported: 2018-02-14 07:57 EST by Vincent Lorenzo CLA
Modified: 2018-02-14 08:30 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vincent Lorenzo CLA 2018-02-14 07:57:12 EST
We tested the required time to create 1000 UML Class in a Class Diagram, using ElementType (Configured Specialization Type: Class Shape [org.eclipse.papyrus.umldi.Class_Shape]).
Currently it takes around 50s for 1000 Classes. 
We analyse that : 
	- the command creation doesn't take time
	- the command execution takes many time
		- the biggest part of the time is taken by the DiagramEventBroker, which notifies many elements on many purpose
			- as the tests create 1000 classes on the root of the diagram (the root Package of the model), we spare many time in org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ModelEditPart.handleNotificationEvent(Notification).
			- the method org.eclipse.gef.editparts.AbstractEditPart.refreshChildren() each called 1 time on each EditPart for the addChild method via the methodorg.eclipse.gef.editparts.AbstractEditPart.addNotify()
				- so for 1 class : 7 refresh, 1 one for the root EditPart and 1 by children EditPart
					-> 7 calls  to getVisibleChildren for 1 classShape, then 2 time for each child
					
				
		We probably should improve the methods refreshChildren and getVisibleChildren. A cache for getVisibleChildren could help (but don't forget the visibility can be obtained using CSS#isVisible).
		
There are 2 EditPolicy probably to improve too. Removing them, we gain around 10s. for 1000 elements: 
	- PapyrusCanonicalEditPolicy
    - QualifiedNamDisplayEditPolicy
    

Commenting the notification in DiagramEventBroker, we drop by 40 seconds to be around 8 s. for 1000 Classes. Of course, it is just informative, the concerned method make requried stuff.