Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » SelectDRepresentationElementsListener performace
SelectDRepresentationElementsListener performace [message #1847825] Tue, 09 November 2021 13:21 Go to next message
Denis Nikiforov is currently offline Denis NikiforovFriend
Messages: 334
Registered: August 2013
Senior Member
Hi

We have a model operation which creates 10-100 thousands of objects. It seems that SelectDRepresentationElementsListener tries to handle this resource change and to select added elements in a table representation.

The problem is that it takes a lot of time:
index.php/fa/41291/0/

1 - our operation, it works long enough but it's not a problem because a user can see a progress and can cancel the operation

2 - Sirius tries to select changed objects in a table. It takes too much time. And a user can't even cancel it

3 - I guess that Sirius checks here whether representations for deleted objects should be closed

4 - I guess that it's dangling references deletion, etc.

The main problem is 2. Here is SelectDRepresentationElementsListener::resourceSetChanged()
                List<DRepresentationElement> elementsToSelect = extractElementsToSelect(event, currentRep);
                if (elementsToSelect != null) {
                    ExecutorService executorService = Executors.newSingleThreadExecutor();
                    executorService.submit(() -> {
                        IEditorPart activeEditor = EclipseUIUtil.getActiveEditor();
                        if (dialectEditor.equals(activeEditor)) {
                            EclipseUIUtil.displayAsyncExec(new SetSelectionRunnable(dialectEditor, elementsToSelect));
                        }
                    });
                }

It finds elements to select, this operation takes a lot of time. And after that it checks whether the editor is active and selects the elements. But our editor is not even active, it's just opened. Another editor is active. Maybe it's possible to extract elements after active editor check?

Is it possible to disable element selection? We don't need to select 100 thousands objects :)

Maybe it's possible to optimize the following method called from extractElementsToSelect():
    private boolean analyseNotifications(ResourceSetChangeEvent event, DRepresentation currentRep, List<DRepresentationElement> keptNotifiedElements) {
        boolean elementsToSelectUpdated = false;
        Collection<EObject> attachedEObjects = null;
        for (Notification n : event.getNotifications()) {
            // ...

It processes each notification separately.
Re: SelectDRepresentationElementsListener performace [message #1847833 is a reply to message #1847825] Tue, 09 November 2021 19:08 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 570
Registered: May 2011
Senior Member
Hi Denis,

Are you sure the selection comes from the inactive editor? I have not been able to reproduce it, I only see new elements appear in the inactive editor, but not selected. However, in the current editor, the newly created element by the tool are indeed selected.

If you go back to your creation tool in the .odesign file, there is a field "Elements to Select". Can you set the expression "service:stdEmptyCollection()" so it won't select the new element on your current representation? I hope this should solve your performance issue.
In your case, I think it will still loop a lot of time in org.eclipse.sirius.ui.tools.internal.editor.SelectDRepresentationElementsListener.analyseNotifications(ResourceSetChangeEvent, DRepresentation, List<DRepresentationElement>) just to produce an empty list. If this is still too slow, could you create a bugzilla [1] so we can look into bypassing the whole process if the field "Elements to Select" is valued as "service:stdEmptyCollection()"?

I admit you made me curious. If you don't mind, why do you need to create 10 to 100 thousands of EObject? :)

Best regards,
Steve

[1] https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Sirius


Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius

[Updated on: Wed, 10 November 2021 18:07]

Report message to a moderator

Re: SelectDRepresentationElementsListener performace [message #1847839 is a reply to message #1847833] Wed, 10 November 2021 04:12 Go to previous messageGo to next message
Denis Nikiforov is currently offline Denis NikiforovFriend
Messages: 334
Registered: August 2013
Senior Member
Elements are not selected in the inactive editor. But method SelectDRepresentationElementsListener::resourceSetChanged() calls extractElementsToSelect() at first (the call takes a lot of time) and only after that it checks whether the editor is active. And if it is active, then it calls SetSelectionRunnable(). So it doesn't matter active editor or not (will elements be selected or not), the slow method extractElementsToSelect() is called anyway. And this method blocks UI for a long time.

We don't define a creation tool to run this operation, so we can't set "Elements to Select". This operation runs a discrete event simulation (DES) for a process model. We have 2 table representations: 1) input parameters for DES 2) execution log for DES (this table contains 10-100 thousands of objects after DES is finished).

The operation is implemented in QVTo. And we run it using a custom toolbar button executing org.eclipse.emf.transaction.RecordingCommand. Replacing it by AbstractCommand with undo disabled doesn't speed up things. In other words it's an external to Sirius command. Maybe we should call it differently?..
Re: SelectDRepresentationElementsListener performace [message #1847841 is a reply to message #1847839] Wed, 10 November 2021 04:50 Go to previous messageGo to next message
Denis Nikiforov is currently offline Denis NikiforovFriend
Messages: 334
Registered: August 2013
Senior Member
I've created bugzilla https://bugs.eclipse.org/bugs/show_bug.cgi?id=577165
Re: SelectDRepresentationElementsListener performace [message #1847864 is a reply to message #1847841] Wed, 10 November 2021 18:13 Go to previous message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 570
Registered: May 2011
Senior Member
Hi Denis,

Thank you for the bugzilla and the added information here. Maybe we should modify the code of this listener, to only process this selection if we are in a creation tool and with an expression in the "Element to Select" field in order to bypass this process in a case like yours. We will look into it.

Best regards,
Steve


Steve Monnier - Obeo Canada
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Performance issue with DialectManagerImpl::getRepresentationDescriptors()
Next Topic:SiriusTabDescriptorProvider performance
Goto Forum:
  


Current Time: Wed Sep 28 16:52:15 GMT 2022

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

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

Back to the top