You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Chad La Joie <la...@itumi.biz> on 2012/02/04 16:58:34 UTC

Most efficient evaluation

I'm looking for the most efficient/performant way to evaluate a
template and have some questions surrounding this.

1. Are Template objects reusable and thread safe?  If they're just
ASTs, it seems like they should be.

2. Does the Velocity/VelocityEngine class cache compiled templates (as
Template objects or anything else)?

3. If yes to both above, is there really any difference between
calling Velocity[Engine].merge and Template.merge?

Thanks.

-- 
Chad La Joie
www.itumi.biz
trusted identities, delivered

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


Re: Most efficient evaluation

Posted by Nathan Bubna <nb...@gmail.com>.
On Sat, Feb 4, 2012 at 7:58 AM, Chad La Joie <la...@itumi.biz> wrote:
> I'm looking for the most efficient/performant way to evaluate a
> template and have some questions surrounding this.
>
> 1. Are Template objects reusable and thread safe?  If they're just
> ASTs, it seems like they should be.

Yes, but you shouldn't have to directly interact with Template
objects, because...

> 2. Does the Velocity/VelocityEngine class cache compiled templates (as
> Template objects or anything else)?

... they are handled (and yes, cached, if you want) internally.  You
just turn caching on.  See User's Guide for more info.

> 3. If yes to both above, is there really any difference between
> calling Velocity[Engine].merge and Template.merge?

Mostly in that VelocityEngine is the API users are expected to use and
Template is really much more of an "internal" class for advanced
purposes.

> Thanks.
>
> --
> Chad La Joie
> www.itumi.biz
> trusted identities, delivered
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>

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