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

Bug 456344

Summary: Use MinimalEObjectImpl.Container as base for Sirius metamodels
Product: [Modeling] Sirius Reporter: Pierre-Charles David <pierre-charles.david>
Component: CoreAssignee: Florian Barbin <florian.barbin>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: belqassim.djafer, esteban.dugueperoux, florian.barbin
Version: 1.0.1Keywords: triaged
Target Milestone: 3.0.0M5   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Big model reverse-sirius
none
Modified Example with less semantic elements en more Sirius elements none

Description Pierre-Charles David CLA 2014-12-30 09:03:26 EST
Our metamodels date back from earlier versions of EMF where EObjectImpl was the best default, but MinimalEObjectImpl.Container (introduced in EMF 2.5) is probably now a better choice, which should lead to reduced memory usage.

Note that we should not blindly switch to the new implem, but try to measure performance (time and memory usage) before/after the switch, to validate and quantify the improvement (if any).
Comment 1 Florian Barbin CLA 2015-01-21 09:58:50 EST
A gerrit that changes the Sirius MM default EObject implementation to MinimalEObjectImpl.Container: https://git.eclipse.org/r/#/c/40037/
Comment 2 Florian Barbin CLA 2015-01-22 04:49:47 EST
I made some measurements with EObjectImpl implementation and MinimalEObjectImpl.Container implementation (with reverse-sirius-10times project)

Memory measurements:
* After having opened the big representation:
** With EObjectImpl:
*** Total retained size: 383 MB
*** AirdResourceImpl: ~ 62MB
** With MinimalEObjectImpl.Container:
*** Total retained size: 354 MB
*** AirdResourceImpl: ~ 62MB

* After having opened the session (without opening any representation):
** With EObjectImpl:
*** Total retained size: 346 MB
*** AirdResourceImpl: ~ 63MB
** With MinimalEObjectImpl.Container:
*** Total retained size: 333 MB
*** AirdResourceImpl: ~ 63MB
Comment 3 Florian Barbin CLA 2015-01-22 04:50:19 EST
Created attachment 250136 [details]
Big model reverse-sirius
Comment 4 Florian Barbin CLA 2015-01-22 08:27:58 EST
Created attachment 250141 [details]
Modified Example with less semantic elements en more Sirius elements
Comment 5 Florian Barbin CLA 2015-01-22 08:44:37 EST
I made additional measurements with a project containing more Sirius elements (DDiagram and DDiagramElement) to emphasize the difference between EOjectImpl and MinimalEObjectImpl.Container.

I made two memory snapshots after having loaded this modeling project: https://bugs.eclipse.org/bugs/attachment.cgi?id=250141

With EObjectImpl:
* Retained size: 325 MB

With MinimalEObjectImpl.Container:
* Retained size: 255 MB

I took org.eclipse.sirius.diagram.business.internal.metamodel.spec.DSemanticDiagramSpec as example:

* With EObjectImpl :
** Objects: 10744
** Retained Size:  8361976 Bytes

* With MinimalEObjectImpl.Container :
** Objects: 10744
** Retained Size:  6385080 Bytes

About 23% saved on this object
Comment 6 Florian Barbin CLA 2015-01-22 09:40:46 EST
I did not notice significant performance differences during the session opening:

With EObjectImpl:
OpenRepresentationsFileJob.java:213 org.eclipse.sirius.ui.tools.internal.views.common.modelingproject.OpenRepresentationsFileJob.performOpenSession(URI, IProgressMonitor) 85,529 ms

With MinimalEObjectImpl:
OpenRepresentationsFileJob.java:213 org.eclipse.sirius.ui.tools.internal.views.common.modelingproject.OpenRepresentationsFileJob.performOpenSession(URI, IProgressMonitor) 83,569 ms
Comment 7 Florian Barbin CLA 2015-01-22 10:12:20 EST
Precision about Comment 5:

By taking the "Strong reachable" Objects, the total retained size (the entire Eclipse) is:

265 MB with EObjectImpl
234 MB with MinimalEObjectImpl.Container
Comment 8 Pierre-Charles David CLA 2015-01-26 04:28:55 EST
Fixed by 77371ac2b9d69d445c8e4d9bb7edabfb7464abb0.
Comment 9 Belqassim Djafer CLA 2015-04-10 04:54:21 EDT
Verified as technical issue
Comment 10 Pierre-Charles David CLA 2015-06-24 11:17:28 EDT
Available in Sirius 3.0.0. See https://wiki.eclipse.org/Sirius/3.0.0.