Re: Optimising Variable to reduce instantiation overhead

Endre Stølsvik <[email protected]> Fri, 17 Mar 2006 12:32:37 +0100 (CET)
Newsgroups gmane.comp.java.webmacro.user
Message-ID <[email protected]>
On Mon, 13 Mar 2006, Keats Kirsch wrote:

| Endre Stølsvik wrote:
| 
| > On Sun, 12 Mar 2006, Alex Twisleton-Wykeham-Fiennes wrote:
| > 
| > | All,
| > | | more performance tweaks, this one to the org.webmacro.engine.Variable
| > class.
| > 
| > Excellent performance tuneup you're into, Alex!
| > 
| > | - made the getVariableName() method check to see if _vname has been |
| > initialised, and if not then build the name before returning it.  This is
| > now | synchronized as it changes the state of the object.
| > 
| > So?
| > 
| > Is it shared across threads?
| >  
| The answer is yes, as we were so rudely reminded when the dynamic #include bug
| was discovered recently.  Compiled template instances are cached and may be
| shared by multiple threads.

That templates are shared, is kinda rather obvious - they are cached. That 
they have som much _modifiable_ internal state isn't necessarily that 
obvious to me.

Endre.