eclipse / xtext-extras

xtext-extras
Eclipse Public License 2.0
20 stars 38 forks source link

xbase expression performance issue with nested feature calls #112

Closed paulluap closed 1 year ago

paulluap commented 7 years ago

It seems that when an xbase expression is deeply nested with feature calls, the performance is poor. The following xbase expression in op will always block the IDE:

//file: test.dmodel

package t{
    entity M{
        op t(){
            (1..10).forEach[
            (1..10).forEach[
            (1..10).forEach[
            (1..10).forEach[
            (1..10).forEach[
            (1..10).forEach[
            (1..10).forEach[
            (1..10).forEach[
            (1..10).forEach[
            (1..10).forEach[
            ]]]]]]]]]]  

        }
    }
}

This can be reproduced using the example dmodel project.

paulluap commented 7 years ago

arithmetic expressions have the same issue: Take the expression below:

-1-1-1-1-1-1-1

It looks like the number of times

org.eclipse.xtext.xbase.typesystem.computation.XbaseTypeComputer._computeTypes(XAbstractFeatureCall, ITypeComputationState)

gets invoked increases exponentially with the number of '-'.

ggallin commented 6 years ago

We use a slightly modified version of the template language https://www.eclipse.org/Xtext/documentation/207_template.html where this problem also occurs with larger files, (i.e. a lot of feature calls). Are there any updates on this issue or can anybody point me to some further informations on this? Kind regards, Pete

Xtext 2.14

kthoms commented 6 years ago

Sorry, no news on that. I would recommend to refactor the code to avoid these deep nestings. I doubt that we have capacity to fix this for 2.14. But if you like to help we would support in reviewing PRs. Starting point would be to examine why XbaseTypeComputer._computeTypes is called that often and if caching somewhere is valid. It is not a trivial thing, though.

ggallin commented 6 years ago

Thanks for your fast reply. I will try to look into your suggested starting point.

cdietrich commented 1 year ago

Closed as wont-fix. Feel free to reopen at github.com/eclipse/xtext