velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bubna <nat...@esha.com>
Subject Re: A more efficient velocity template?
Date Thu, 17 Jun 2004 16:10:02 GMT
Twan Kogels said:
> Hello Nathan,
...
> > > The template is a complex one with a lot of custom macro's and if and
else
> > > statements.
> >
> >sounds like part of your problem's right there. :)  as Peter said, moving
> >business logic to java can help.  java is faster than VTL.
>
> But my macro's don't define business logic, they are mainly used to "print"
> common interface components like a menu or a button "ok" "cancel" combo. I
> also have a macro which prints a fieldname + fieldvalue combo. This combo
> is called about 40 times in one template. Is it wise to move this macro to
> java code (tool) and call it like: $fieldtool.print($name $value)?

i would say no.  i doubt it would help speed things up much, if at all, and it
would be a major design faux pas. :)  keep the view/UI logic in the template.

...
> > > I'm currently using velocity 1.3.1.
> >
> >from what Peter says, Velocity 1.4 sounds faster.  i know it does have
> >introspection improvements, so i'm not surprised.   also, i believe Java
1.4
> >has big improvements in reflection performance over previous versions.
since
> >Velocity uses a lot of reflection...
>
> I installed velocity 1.4 and after a bit of struggle with a nullpointer
> exception it worked. I don't know what you guys did but the speed increase
> is enormous:
>
> 67.55% - 329 ms - kaart.KaartController.handleRequest()
> 22.17% - 108 ms -
org.apache.velocity.servlet.VelocityServlet.mergeTemplate()
>
> (the old situation as a reference)
> 62.38% - 854 ms -org.apache.velocity.servlet.VelocityServlet.mergeTemplate()
> 35.35% - 484 ms - kaart.KaartController.handleRequest()
>
> And i only replace 1.3 with 1.4 :-))
...

wow.  that's cool!

Nathan Bubna
nathan@esha.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message