2

I have an application which use the same groovy script for multiple times. Everytime, it compiles the same script again and again during runtime. In order to improve the performance, I need to compile the script only once and store the compiled script in database which can be later fetched and used with binding variables.

Thanks,

  • Can you keep the result of the compilation in a hash table? – Erich Kitzmueller May 11 '20 at 12:26
  • I cannot use hash table, because I need to store the script in postgresDB. Also, this Script object is extended by GroovyObjectSupport class which has the properties included. – Monisha Govindasamy May 11 '20 at 12:38
  • 1
    time to read compiled script from the database could be comparable to the time required to compile script. so it's better to cache compiled version it in memory. I also suggest you to store plain script in the database and compile it once after loading from database. to read compiled script from the database you have to implement custom GroovyClassLoader and in any case store it into hashmap... – daggett May 11 '20 at 16:20
  • https://stackoverflow.com/questions/57861891/groovy-writing-dynamically-compiled-class-to-disc – injecteer May 11 '20 at 20:50

0 Answers0