Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-2530

Optimize GrammarParser.java in CSS Lib module

Log workAgile BoardRank to TopRank to BottomAttach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskConvert to sub-taskLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments


    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 11.0
    • Fix Version/s: None
    • Component/s: web - CSS Editor
    • Labels:


      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!



          $i18n.getText('security.level.explanation', $currentSelection) Viewable by All Users



              • Created:

                Issue deployment