Scoping Performance [message #1847229] |
Wed, 20 October 2021 02:16  |
Eclipse User |
|
|
|
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.
- 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)
- 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:
- why is a cancelled validation task clearing the cache? Can I disable that somehow?
- 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.
Cheers!
Alfredo
PS: a workaround is to split the larger files into smaller ones
|
|
|
|
Re: Scoping Performance [message #1847265 is a reply to message #1847250] |
Thu, 21 October 2021 09:47  |
Eclipse User |
|
|
|
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 (Type.property) 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.
|
|
|
Powered by
FUDForum. Page generated in 0.02938 seconds