Copied from user.groovy.codehaus.org:
Is there a way to pre-compile groovy templates? Looking at the something like the SimpleTemplateEngine I see the template file is parsed into a groovy script which is then stored in a SimpleTemplate object then each time the template object’s ‘make’ method is called a new instance of the script is created with bindings and the script is run. When I run the templates on the server I noticed an initial delay when I first hit a new template (much like the initial delay with a jsp as it is compiling) I’m assuming that the script is being compiled for the first time. Subsequent visits to the template are much, much faster. So I’m wondering if somehow...
Parsing the templates and compiling the generated scripts would eliminate that initial lag. Could be done in the init-method of the servlet.