velocity-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bojan Smojver <bo...@binarix.com>
Subject Re: performance questions - faster Introspector
Date Mon, 10 Sep 2001 09:17:15 GMT
Attila Szegedi wrote:
> 
> ----- Original Message -----
> From: "Bojan Smojver" <bojan@binarix.com>
> To: <velocity-dev@jakarta.apache.org>
> Sent: 2001. szeptember 10. 10:01
> Subject: Re: performance questions - faster Introspector
> 
> >
> > One other idea might be to not have static fields in the Introspector,
> > but rather make them regular private class fields and then keep the
> > logic simple since it would already be per classloader. But that would
> > probably increase the overall memory usage of the cache since there
> > could be duplicates of classes/methods in multiple instances of
> > Introspector cache. I'm not really sure what I'm talking about here but
> > what the heck...
> >
> 
> Umm. From this point of view, it really makes no difference if the cache is
> accessed through a static field, or through instance field of a singleton
> (which is itself probably also referred by a static field). What REALLY
> helps here is to have Velocity classes loaded through the same disposable
> class loader used to load your classes - that is, have them in WEB-INF/lib
> or WEB-INF/classes.
> 
> Attila.

Just thinking out loud...

My understanding is that RuntimeInstance creates an Introspector object
and VelocityEngine creates a RuntimeInstance. So, there is a 1 to 1
relationship between a VelocityEngine instance and an Introspector
instance.

Currently, if Velocity jar is in Tomcat's lib/apps, that would mean that
cache is one for all apps since the classloader for lib/apps keeps one
copy of static fields for all Introspector objects. If Velocity jar was
in WEB-INF/lib then each Introspector object would share the same static
fields within that app.

If fields that are holding the maps in the Introspector were not static,
that would mean that there would be one copy of them in each
Introspector, ie. one per VelocityEngine. I'm not sure if that's good,
bad or ugly, but you're correct, it wouldn't be per classloader, it
would be per instance of VelocityEngine, so it would be even more
granular then classloader. Aieee!

OK, I'm going to take a nap now, my head hurts...

Bojan

Mime
View raw message