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

Allow new instances of GroovyScriptEngine to use previously compiled .class files

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.7.4
    • None
    • GroovyScriptEngine
    • None

    Description

      If I call CompilerConfiguration#setTargetDirectory then GroovyScriptEngine will save .class files for scripts it compiles. However, when creating a new instance of GroovyScriptEngine (e.g., because of application restart) it will not reuse those .class files and instead recompile all scripts. This compilation can be time consuming.

      Instead, GroovyScriptEngine#scriptCache can be written and reloaded and CompilerConfiguration#getTargetDirectory could be one of the urls that GroovyClassLoader users. Writing can be done just when a target path is given and CompilerConfiguration#getTargetDirectory is set, reloading can be another public method that users should invoke (e.g., since they know which dump file matches which instance)

      It would also be nice if GroovyScriptEngine saved the output of each script as a jar. This will allow deploying pre-compiled jars of some scripts to speed up first usage of applications.

      Attachments

        Activity

          People

            Unassigned Unassigned
            ittayd Ittay Dror
            Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: