Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Avoid expensive scope calculation
Avoid expensive scope calculation [message #1067391] Mon, 08 July 2013 13:43 Go to next message
Sergio Otero is currently offline Sergio OteroFriend
Messages: 39
Registered: June 2012
Member
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 13:54 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
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


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Re: Avoid expensive scope calculation [message #1067428 is a reply to message #1067395] Mon, 08 July 2013 15:27 Go to previous message
Sergio Otero is currently offline Sergio OteroFriend
Messages: 39
Registered: June 2012
Member
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: Fri Mar 29 05:39:22 GMT 2024

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

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

Back to the top