velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <>
Subject Re: performance impact of calling variables
Date Sun, 08 Sep 2002 16:18:44 GMT
On 9/6/02 5:20 PM, "blindholm" <> wrote:

> Using Struts/Velocity
> I have a property set in the file that contains a
> path. I then use that property within the Velocity pages.
> Is there any benefit to calling that property once and setting it to a
> variable in the velocity page? Instead of calling $msg.imagepath each time I
> would do the following at the beginning of each page.
> #set ( $velpath = $msg.imagepath )
> then call $velpath when I need it.
> Or, is there another recommended location within velocity to set global
> variables that would be equivalent or faster?

That would be faster - I am assuming that $msg has a get(String) method or

The difference is that you save the introspection to find the get method and
call it.  If performance is critical, then yes, getting those 'statics' out
of the way first will help.

Geir Magnusson Jr. 
Research & Development, Adeptra Inc.

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

View raw message