Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Avoid expensive scope calculation
Avoid expensive scope calculation [message #1067391] Mon, 08 July 2013 09:43 Go to next message
Eclipse UserFriend
Hi

I've build an Xtext DSL that has to work with more than 5000 source files and i've been running into OutMemory and performance problems.

I've been doing some profiling and tuning (for example with resource descriptions) and now i'm able to finish but it takes quite a lot of time and memory.

In the profiler i've seen that "resolveLazyCrossReference" is the main problem and more that 60% of the time is spent in the functions where i calculate the scope of variables.

This scope calculation is quite complex but it could be reused bewteen statements that belong to the same block. For example:

declare var1
declare var2
declare var3

statement1 var1 /* in scope var1,var2,var3 */
block {
  declare var4

  statement2 var4 /* in scope var1,var2,var3,var4 */
  statement3 var4 /* in scope var1,var2,var3,var4 */
}
statement4 var1 /* in scope var1,var2,var3 */


In "traditional" compilers, scope is calculated at every statement with little incremental steps, but in Xtext each potential use of a scope is calculated via a call to scope_Object_atribute.

So, the final questions are:

1. Is there a way to use a incremental approach?
2. If i try to cache the result per block in a hashtable, how can i detect that the cache is dirty or any other potential problem?

Thanks

Sergio

Re: Avoid expensive scope calculation [message #1067395 is a reply to message #1067391] Mon, 08 July 2013 09:54 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

an incremental pattern cannot work in general (for any conceivable Xtext application). You could use the IResourceScopeCache for caching. The default implementation empties the cache when the resource is changed.

Alex
Re: Avoid expensive scope calculation [message #1067428 is a reply to message #1067395] Mon, 08 July 2013 11:27 Go to previous message
Eclipse UserFriend
I think that will work for my case

Thanks
Previous Topic:copying node model information between resources
Next Topic:Parse an absolut path
Goto Forum:
  


Current Time: Wed Jul 16 05:31:15 EDT 2025

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

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

Back to the top