SecureGroovyScript.evaluate always parses the Groovy script. There should be an option to cache the parsed script (it is final). Otherwise the performance for some use cases is poor (if the script is called very often). (For details see JENKINS-14614).

          [JENKINS-35071] Do not compile script on every evaluate

          Jesse Glick added a comment -

          Caching the Script in SecureGroovyScript is not a good idea—too easy to introduce a memory leak. Rather it would be necessary to introduce a new API type representing a script ready to run, with an Object evaluate() throws Exception method (TBD whether a fresh Binding binding needs to injected on each call).

          Jesse Glick added a comment - Caching the Script in SecureGroovyScript is not a good idea—too easy to introduce a memory leak. Rather it would be necessary to introduce a new API type representing a script ready to run, with an Object evaluate() throws Exception method (TBD whether a fresh Binding binding needs to injected on each call).

            jglick Jesse Glick
            drulli Ulli Hafner
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: