Hi, I wanted to see if the Renderable[1] interface in velocity 1.6 could be used to improved performance in click. And indeed it can!
I have made a quick and dirty hack that makes click-bench CLICK test perform more than 40% faster. From 567 to 839 request per second (average of 3 run after 1 discarded warm up run). The patch can be found here: http://people.apache.org/~bckfnn/renderable.patch.txt The patch add Renderable to our Control interface and an implementation of the interface in AbstractControl that uses an implementation of HtmlStringBuffer that writes directly to the output writer. It also changes the Decorator interface: - public String render(Object object, Context context); + public void render(Object object, Context context, HtmlStringBuffer buffer); so that columns can be written directly to the table's buffer. The drawback of the patch are: * Direct dependency on velocity * Changes to the Decorator interface. I think the Decorator change can be made backward compatible by adding a fast Decorator2 interface and eventually deprecating the slower Decorator interface. The dependency on velocity.jar is IMO acceptable for such a large performance gain. The patch contains some unused code in VelocityTemplateService that tries to avoid the dependency of velocity.jar, and while it improves performance of the CLICK test, it makes the CLICK+velocity test slower due to the overhead of registrring a ReferenceInsertionEventHandler in velocity. regards, Finn [1] http://velocity.apache.org/engine/releases/velocity-1.6.4/apidocs/org/apache/velocity/runtime/Renderable.html
