eclipse / elk

Eclipse Layout Kernel - Automatic layout for Java applications.
https://www.eclipse.org/elk/
Other
249 stars 83 forks source link

Slow down of first context menu due to ELK loading services #1020

Open Bananeweizen opened 5 months ago

Bananeweizen commented 5 months ago

Describe the bug Opening the first context menu in the package explorer/navigator of an application containing ELK leads to a notable delay before the menu becomes visible. ELK causes half a second of delay by loading layout services when it's property tester is used the first time:

grafik

Expected behavior Bundle activators should do as little work as possible, as bundle activation can be triggered by UI interaction and will then slow down everything happening on the UI thread.

ELK Version 0.9.0

Additional context Looking at the relevant method at https://github.com/eclipse/elk/blob/f53099f7fee46735a88c0b4d67fcdf943a0179f2/plugins/org.eclipse.elk.core.service/src/org/eclipse/elk/core/service/ElkServicePlugin.java#L136 it seems like all of that could be executed inside of LayoutMetadataService.getInstance() instead, which would defer the code until it's needed, and the plugin activation would be fast again.