Bug 510519

Summary: [PERFO] Seems like Tree content creation can get into a n^n (or similar) complexity in some cases
Product: [Modeling] Sirius Reporter: Maxime Porhel <maxime.porhel>
Component: TreeAssignee: Project Inbox <sirius.tree-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: cedric.brun, pierre-charles.david
Version: 4.1.0Keywords: performance, triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Bug Depends on: 509519, 510520    
Bug Blocks: 510507, 510508    

Description Maxime Porhel CLA 2017-01-16 10:45:26 EST
+++ This bug was initially created as a clone of Bug #509519 +++

- Import the attached projects (there is a Viewpoint Specification Projet and a Modeling project with a single empty Ecore)
- Make sure the "Perfo Tree" viewpoint is enabled and create a new Tree representation on the EPackage
- Right click in the tree on "Create Many EClasses"
-> the code which is launched is in perfo.tree.design.Services.createMany(EPackage) and basically create 20K new EClasses each having 10 attributes, this should end up being a tree with 20K*10=>200K tree items.
-> the UI thread is blocked and CPU goes crazy for a fairly long time, I gave up after 5 minutes

No doubt there is n^n algorithm working its magic here. 

First hint: after a bit of digging, commenting out: 

willBeExpandedOnSelection(RefreshPlan) to always return false makes the whole tree to be created in about 10 seconds