Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
11.0
-
None
Description
Trying to bring the CSS module grammar (the .properties files in the CSS Editor module) up to date causes severe performance issues in NB due to the recursive nature of the parseElements() method of the GrammarParser class.
1) Recursive grammar (such as that of the calc() function in css) will cause a stack overflow as parseElements() will keep calling itself to resolve references until the stack is blown
2) Not using recursive grammar will still cause major performance issues will more than 1/2 levels of references, as memory gets eaten due to the parseElements() method not having a cache (e.g. it will call itself to try and resolve a reference it has already resolved previously, doing a lot of unnecessary work). In its current implementation it can blow the Java heap.
I have grammar pretty much ready to go to implement CSS Values and Modules function in NB (e.g. proper implementation of calc(), min(), max(), attr() etc.), and have got 2) to be less of an issue by using a HashMap to cached reference properties so they don't get resolved again. Performance is still "stutery" at best - at NB memory still gets used up, but then reclaimed by the GC. Could really use some help properly optimizing this class.
I think this should be fairly straightforward for somebody who knows what they are doing! I'd love to help bring CSS support up to date!