Avoid expensive scope calculation [message #1067391] |
Mon, 08 July 2013 13:43 |
Sergio Otero 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
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02774 seconds