Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 490908

Summary: Performance issue for session loading when resources have many roots
Product: [Modeling] Sirius Reporter: Laurent Delaigue <laurent.delaigue>
Component: CoreAssignee: Maxime Porhel <maxime.porhel>
Status: CLOSED FIXED QA Contact: Pierre-Charles David <pierre-charles.david>
Severity: normal    
Priority: P3 CC: maxime.porhel, pierre-charles.david
Version: 3.1.0Keywords: triaged
Target Milestone: 3.1.5   
Hardware: PC   
OS: Windows NT   
See Also: https://git.eclipse.org/r/69721
https://git.eclipse.org/r/69722
https://git.eclipse.org/c/sirius/org.eclipse.sirius.git/commit/?id=94e9f3293ad6893b8cd489fcb4ef386356e2ba7c
Whiteboard:
Bug Depends on:    
Bug Blocks: 490983    

Description Laurent Delaigue CLA 2016-04-01 09:20:01 EDT
I use a model with 5 resources that have many inter-resource links.
One of these resources has many roots (4300).
Loading my session takes 3 minutes, whereas it takes 10 to 15 seconds to load the resources with the reflective ecore editor.

My first analysis indicates that the culprit seems to be ResourceQuery.isRepresentationsResource():
Its implementation goes over each root of the resource to check if it's a DAnalysis. This wouldn't be a problem if it were done only once per resource, but the result isn't cached and ResourceQuery.isRepresentationsResource() is called apparently each time there is a cross-resource link (by the cross-referencer installation and LocalResourceCollector.addInterResourceResourceReference(...))

I think Sirius should find a way to cache the information of whether or not a resource is a representation resource instead of recomputing it each time addInterResourceResourceReference is called. Or maybe addInterResourceResourceReference should do nothing if a reference between the same resources is already known?
Comment 1 Maxime Porhel CLA 2016-04-01 09:48:23 EDT
Hi Laurent, thanks for the report. 

Note that the aird or representation resource are handled by Sirius, and we currently always put the DAnalysis as first root. So IMO we should only analyse the first root. 

In an aird, it might be possible to have additional roots (additional specific data, annotation, ..) but in this query we do not need to analyze them.
Comment 2 Eclipse Genie CLA 2016-04-01 10:18:46 EDT
New Gerrit change created: https://git.eclipse.org/r/69721
Comment 4 Maxime Porhel CLA 2016-04-05 08:46:06 EDT
Corrected on Sirius 3.1.x for Sirius 3.1.5.
Comment 5 Pierre-Charles David CLA 2016-04-14 04:48:18 EDT
Verified on Sirius 3.1.5rc1.
Comment 6 Maxime Porhel CLA 2016-04-21 08:45:29 EDT
Available in Sirius 3.1.5.