Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Scoping Performance
Scoping Performance [message #1847229] Wed, 20 October 2021 06:16 Go to next message
Alfredo Aldundi is currently offline Alfredo AldundiFriend
Messages: 38
Registered: July 2009
I have some scopes that are more expensive to calculate. This leads to hanging editors, especially in larger files. I have some ideas how to tackle the problem and have already experimented a bit with potential solutions, but I have not yet reached a satisfying solution nor am I sure if this is the appropriate way to do it.

The first idea was to use the IResourceScopeCache to cache the scopes. However, as it turned out the cache is extremely aggressively cleared in a lot of situations, which are unecessary in our case.

  1. cancelled validation task due to repetitive typing (nothing is cached by validations in our case and even if there would be caching, it would not invalidate the cache)
  2. reconciling drops and recreates EMF objects which lead to change notifications that clear the cache; in our case, this is useless, because that particular EMF object does not impact scoping at all

Experimentally, I have implemented my own IResourceScopeCache (extending OnChangeEvictingCache) to create my own CacheAdapter to override isSemanticStateChange (return false in the irrelevant cases). This solves the cache clear due to reconciling but not due to cancelled validation task.

My questions are:

  1. why is a cancelled validation task clearing the cache? Can I disable that somehow?
  2. how would you approach the performance tuning? Which knobs can I turn to make this faster? Obviously, I will try to tune scope calculation, but this will have its limits

One idea was also to store more information in the index (IResourceDescriptionStrategy). However, this does not help as it is not possible to navigate cross references from there.


PS: a workaround is to split the larger files into smaller ones
Re: Scoping Performance [message #1847250 is a reply to message #1847229] Thu, 21 October 2021 06:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14683
Registered: July 2009
Senior Member
1. no idea, i assume you have to debug into the cache invalidation. my assumtion is that the validation job is cancelled if model changes, which also implies an outdated cache
2. you should really have a look what in your scope calculation is so expensive. maybe you do things that should not be done the way you do or that could be done in a more performant way. BUt of course to judge that more details would be needed

Twitter : @chrdietrich
Blog :
Re: Scoping Performance [message #1847265 is a reply to message #1847250] Thu, 21 October 2021 13:47 Go to previous message
Alfredo Aldundi is currently offline Alfredo AldundiFriend
Messages: 38
Registered: July 2009
The expensive part in my scope calculation is traversing an inheritance hierarchy to find the correct property. Finding the properties on a certain variable type requires traversing the inheritance hierarchy, which is per se expensive. I would like to cache as much possible, but Xtext drops the cache so aggressively. I would like to cache as much as possible. I know that in many cases dropping the cache just because of "any" change is dead stupid. Improving the performance of scoping ( is desirable but will have its limits.

So, either I implement my own index and keep it up to date (which seems a daunting task) or I find some other smart way to improve the situation.
Previous Topic:Default Cross-References
Next Topic:problems with importing xtext libraries
Goto Forum:

Current Time: Wed May 29 02:28:26 GMT 2024

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

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

Back to the top