After building a Spoofax project, all Stratego files in the project are re-analyzed (see Spoofax/687). Since the Stratego analysis is not incremental, this takes a long time. However, it used to be a lot faster, now it seems to take 30 seconds for the entity language, and 1:15 minutes for the QL project.

During this time, editor services (such as reference resolution, code completion, and selection) are blocked by the analysis, because there may only be one Stratego invocation running at a time. This is very annoying when developing a language, since it requires a long wait before testing out editor services.

Some of this increase may be contributed to the increased size of the runtime libraries, which are generated into the project and re-analysed on every build. If I turn off that generation, the Stratego analysis for the Entity language only takes a few seconds, and 35 seconds for the QL project (probably because it uses concrete syntax and has more Stratego files). So for bigger project it is still annoyingly slow.
Some recent changes into the locking scheme for Stratego analysis may also contribute to the increased time, but I’m not sure if this is the case, maybe Oskar can say something about that?

Possible fixes for this problem:

  • Allow concurrent Stratego usage, to not block editor services during analysis.
  • Make Stratego analysis incremental (
  • Use library form of runtime-libraries to reduce the analysis times somewhat (although the editor would still need to analyze the rtree of the runtime-libraries)
Submitted by Gabriël Konat on 14 April 2014 at 11:22

On 14 April 2014 at 11:22 Gabriël Konat tagged improvement

On 14 April 2014 at 11:22 Gabriël Konat removed tag error

On 14 April 2014 at 11:22 Gabriël Konat tagged performance

On 14 April 2014 at 11:22 Gabriël Konat tagged stratego

On 15 April 2014 at 00:10 Oskar van Rest commented:

I just discovered that updating the outline and the outline selection were both blocking the UI ever since I introduced the Stratego-based outline several months ago. This made the editors less responsive especially during building and after analysis. This is fixed now:
This is not going to speed up analysis, but definitely improves the user experience.

The outline view and properties view are still blocked by analysis indeed, because there is no concurrent Stratego usage. Currently, if the user makes n selections during analysis, the properties and outline view will get updated n times right after analysis. This still only takes a few milliseconds, so it doesn’t really make things slower, but it should be improved indeed.

On 26 May 2014 at 02:06 Peter Mosses commented:

I’m using the unstable release. My project builds fast enough, but then when I try to select some text in an already-open editor, Eclipse hangs (unresponsive, with full CPU usage), sometimes displaying ‘Updating properties view’, and I’m wondering whether it’s related to the above analysis issue? I got it working first in 1.1, and only ran into the hanging problem after migrating to 1.2 and SDF3. Is it possible to disable the properties view update in my editor project somehow? BTW, my project is using concrete object language syntax in generate.str.

On 26 May 2014 at 11:14 Gabriël Konat commented:

If it hangs shortly after building, it is probably a manifestation of this issue. I know Oskar fixed several issues with selection and the property view hanging Eclipse, but they might not be in unstable. Does the same happen in nightly?

On 26 May 2014 at 11:48 Peter Mosses commented:

In the unstable release, the symptoms are that a (clean) build completes OK, then I see about 10 seconds of low CPU activity, after which the CPU activity becomes negligible, and everything seems fine. The contents of is merely the following (valid) Caml Light program:

if true then false else true;;

I can open the file with my Spoofax editor, and still nothing goes wrong. But as soon as I select some text in the file, I see ‘Updating properties view’ and Eclipse hangs immediately. The CPU usage quickly goes to maximum – I let it run for 5 mins once, and it showed no sign of stopping.

I’ll now try installing the nightly version in a fresh instance of Eclipse, to see whether that fixes it.

On 26 May 2014 at 13:14 Peter Mosses commented:

Essentially the same happens with nightly: the only difference is that it now displays "Updating outline view selection’ instead of ‘Updating properties view’.

On 26 May 2014 at 13:28 Gabriël Konat commented:

Did you rebuild the language using the nightly Spoofax before testing?

On 26 May 2014 at 13:38 Gabriël Konat commented:

I just tested locally here and do not run into the issue, maybe it is specific to your project? Could you try if the generated entity project works? If that works there might be something wrong with your project, I could have a look at it if that is the case.

Some other things that you can try:

  • Turn off outline and/or property views: in editor/LANGUAGE-Views.esv, comment out the outline view and property view definitions.
  • Turn off hover tooltips: in editor/LANGUAGE-References, comment out hover definition.
  • Close the outline and property view if you have them open.

On 26 May 2014 at 19:10 Peter Mosses commented:

Yes, I did a clean rebuild the language using the nightly (but using a checkout of a project created originally with the unstable release).

However, after turning off the outline and property views and the hover tooltips, I now ran into a build failure. When trying to diagnose that, I noticed that there was a warning about a template with no constructor in the build log: I’d omitted a {bracket} annotation from a rule. Although adding that annotation didn’t fix the build error in the nightly Spoofax, it does seem to have helped when I added it in the unstable release: Eclipse has now stopped hanging when I select some text in!

I’ll take another look at my build issue with nightly when I have time to do it more carefully (using a fresh editor project, rather than checking out one created under the unstable release, in case the *.esv files have changed).

BTW, one other warning in the build log that might be relevant was regarding the use of StrategoMix for concrete syntax:

    [java] Calling on-save handler for: /Users/pdm/Workspaces/Eclipse-Spoofax-nightly/CL/syntax/Stratego-CL.sdf3
    [java] Warning: Could not generate template element from symbol: parameterized-sort("Module",[sort("StrategoHost"{Use(Result(592))})])
    [java] Warning: Could not generate template from production: prod([parameterized-sort("Module",[sort("StrategoHost"{Use(Result(592))})])],sort("Start"{Def(URI(Language("TemplateLang"),[ID(NablNsSort,"Start",NonUnique),ID(NablNsModule,"Stratego-CL",Unique("/Users/pdm/Workspaces/Eclipse-Spoofax-nightly/CL/syntax/Stratego-CL.sdf3/0"))]))}),no-attrs)
    [java] Warning: Could not generate template from production: prod([lit("\"|[\""),sort("Expr"{Use(Result(595))}),lit("\"]|\"")],parameterized-sort("Term",[sort("StrategoHost"{Def(URI(Language("TemplateLang"),[ID(NablNsSort,"StrategoHost",NonUnique),ID(NablNsModule,"Stratego-CL",Unique("/Users/pdm/Workspaces/Eclipse-Spoofax-nightly/CL/syntax/Stratego-CL.sdf3/0"))]))})]),attrs([term(default(appl(unquoted("cons"),[fun(quoted("\"ToTerm\""))]))),prefer]))

I’m using SDF2 context-fre syntax instead of templates in Stratego-CL.sd3, because it seems that symbols such as <Module[[StrategoHost]]> aren’t recognised as placeholders in SDF3. Should I be using a different notation or idiom in connection with StrategoMix, or can I ignore that warning?

On 26 May 2014 at 21:54 Oskar van Rest commented:

To add to the list of Gabriel, you may also want to try creating a new workspace and re-importing your projects. This helped for me more than once when nothing else seemed to work.

Regarding the outline and properties view: in the nightly build they are not updated when the views are closed. But in the unstable build, the properties view still gets “updated” even when the view is closed. I cannot explain why it was hanging though and I’m not sure if these are backwards compatibility issues of Spoofax or whether your workspace got corrupted or something.

I have no experience with StrategoMixes so perhaps somebody else can help you with that.

Log in to post comments