Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-9408

Avoid unnecessary looking up default import classes when resolving types

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.0.0-alpha-1, 3.0.2
    • None
    • None

    Description

      ResolveVisitor will try to look up default imported classes from these packages "java.lang.", "java.util.", "java.io.", "java.net.", "groovy.lang.", "groovy.util.".

      For example, when compiler finds Closure in the AST, it will try to look up "java.util.Closure", if failed, then "java.io.Clousre", ..., at last look up "groovy.lang.Closure".

      As we can see, some of the above looking up is not necessary, we can avoid them by warming up org.codehaus.groovy.control.ResolveVisitor#DEFAULT_IMPORT_CLASS_AND_PACKAGES_CACHE

       

      P.S. warming up the cache costs about 0.226s on my machine

       

      Attachments

        Issue Links

          Activity

            People

              daniel_sun Daniel Sun
              daniel_sun Daniel Sun
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m