Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » A way to reduce memory cost during create diagram
A way to reduce memory cost during create diagram [message #1779440] Mon, 08 January 2018 03:49 Go to next message
mind calm is currently offline mind calmFriend
Messages: 57
Registered: July 2017
Member
Hi,

As mentioned in another topic, https://www.eclipse.org/forums/index.php/m/1775006/ , i was found memory grows in speed of O(n²) by model size. Now i have a way to fix it.

In function DiagramDialectServices.createRepresentation(),
before canonicalSynchronizer.synchronize(), we can remove the TransactionChangeRecorder from gmfDiag.eAdapters(). After canonicalSynchronizer.synchronize(), we add the TransactionChangeRecorder back.

The TransactionChangeRecorder is used for undo/redo, during create representation, each creation of a nodeImpl will trigger TransactionChangeRecorder to create a FeatureChangImpl for recording the value before create this nodeImpl, so the memory grows in O(n²).

As my test, the memory sharply reduced while the model size is huge. But i don't know whether the modification brings other potential issues.

In my opinion, the representation creation can not be undo is acceptable.


Best regards!

by Keep Mind Calm
Re: A way to reduce memory cost during create diagram [message #1779454 is a reply to message #1779440] Mon, 08 January 2018 10:02 Go to previous messageGo to next message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
Hi,

I think the solution you propose can have impacts because some notifications will not be forwarded, the change recorder will not be added to new objects, etc...
Make undoable the representation creation is not trivial and must be studied.

Some improvement thought could be to not add one by one the nodes in the same list but instead to make an add all operation when creating the representation. So instead of having n² you will have n that is already much better. One feature change for all additions.

You can make a Sirius ticket to improve memory performance from representation creation. But it will not be a priority since other users does not have a memory problem. Your use case is kinda extreme.

Generally speaking Sirius is used with many representations to show your data so it can be readable from a human perspective. You tend to avoid having all your model elements on the same representation. I don't know why you need to show so much elements on a diagram. It seems to me that it would be not efficient for a human to exploit such diagram.

Regards,

Pierre



Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: A way to reduce memory cost during create diagram [message #1779517 is a reply to message #1779454] Tue, 09 January 2018 03:10 Go to previous messageGo to next message
mind calm is currently offline mind calmFriend
Messages: 57
Registered: July 2017
Member
Hi, Pierre Guilet

Thanks for your reply. I agree with your improvement thought of "make an add all operation", it is the best way, but it is a little difficult for me now.

I debugged my modification, found the change recorder is added to the the new objects, because i add the change recorder back to the DiagramImpl(type of gmfDiagram) after canonicalSynchronizer.synchronize(), and it will add to the children of the DiagramImpl automatically.


Best regards!

by Keep Mind Calm
Re: A way to reduce memory cost during create diagram [message #1779529 is a reply to message #1779517] Tue, 09 January 2018 09:32 Go to previous message
Pierre Guilet is currently offline Pierre GuiletFriend
Messages: 250
Registered: June 2017
Senior Member
Ok in a pure Sirius context in your specific case it may or may not work. I don't have the answer. If you really need these feature either you can do a Sirius ticket but I can't tell you if it will be treated and when. Or it will be up to you to use your solution and check you are breaking nothing :)

Regards,

Pierre


Pierre Guilet - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Trouble With Element Based Edges
Next Topic:Dumb Question - What does "ai" stand for in ".aird"?
Goto Forum:
  


Current Time: Sun Mar 29 19:34:30 GMT 2020

Powered by FUDForum. Page generated in 0.02802 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top