velocity-user mailing list archives

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

> Using Struts/Velocity
> 
> I have a property set in the Application.properties 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
something?

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.
geirm@adeptra.com
+1-203-247-1713



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


Mime
View raw message