velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Bubna" <>
Subject Re: velocimarco.library property and StringResourceLoader
Date Thu, 08 Jan 2009 16:58:16 GMT
On Thu, Jan 8, 2009 at 7:18 AM, Steve Cohen <> wrote:
> Raymond Auge wrote:
> Thanks, Ray.  Further comments and questions inline
>> Hey Steve,
>> I just re-purposed our entire Velocity usage to use StringResourceLoader
>> where before we were calling "evaluate()" ALL THE TIME... it was killer
>> on resources as you might imagine.
> Hmm.  I haven't noticed resource problems yet.  I'm not calling evaluate()
> now; I am using the VelocityEngine.mergeTemplate() approach.  Does
> mergeTemplate() have a greater or lesser resource-consumption footprint than
> evaluate()?
> so I guess my question now boils down to what the tradeoffs are in resource
> consumption between evaluate() and mergeTemplate().  I was looking at
> StringResourceLoader more as a tool of development convenience than as a
> tool of resource maximization, but it looks like that may not be not its
> primary purpose.

StringResourceLoader is to allow Strings to be turned into cache-able
Template objects, so that your string template needn't be re-parsed on
every request.  It uses more memory than evaluate, but saves you
processor cycles.   if anything, evaluate() is the convenience tool
and StringResourceLoader is for more production-type situations

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message