Initially, RIFE templates were first converted to real Java source files and then compiled on-the-fly with a regular Java compiler. Since I started using ASM for the Java continuations engine of the web framework, I quickly throught that it would be a good idea to use it for generating bytecode directly from the template engine.
Since yesterday I got rather fed up with the wait everytime I modified a template file, I decided that I'd give it a shot. In less than half a day I got all the old code disabled and replaced by suitable ASM visitors. It truly is a great bytecode generation and manipulation library. A nice side effect is that if you don't precompile the templates for distribution (ie. only let them be generated at runtime) no disc access is performed at all. The bytecode is generated in memory and passed directly as a byte array to a dedicated classloader.
The speed benefits that I hoped this would offer definately made the effort worth-while. The pre-compilation of all templates of our latest project now takes 44 seconds instead of 8 minutes 33 seconds, that's almost 12 times faster!!!