tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Boynes <>
Subject Re: [taglibs] XPath support
Date Tue, 13 Jul 2010 02:04:29 GMT
On Jul 12, 2010, at 1:08 AM, Mark Thomas wrote:
> On 12/07/2010 06:40, Jeremy Boynes wrote:
>> Implementation seems to work but does not provide as much benefit as expected. Jasper
tag pooling does not pool tags with the same attribute values so the select attribute is set
every time causing recompilation. The time taken to iterate 1000 <x:out> tags drops
from around 2800ms to 1800ms.
> Providing the same attributes with the same values are present, Jasper
> should be pooling the tags. There was a bug in this area [1] but it was
> fixed some time ago. If this isn't the case then please open a Tomcat
> bug and provide a test case.

I opened 49589 [2] to illustrate this behaviour. Most of the issues related to 38197 discuss
tags being invoked multiple times before release is invoked, which is actually what is desired
here with the additional optimization that constant attributes like "select" on <x:out>
don't get reset. That would increase the complexity of the tag pooling though as it would
need to be able to differentiate initialized instances.

>> To work around this I added a thread-local cache of compiled XPath expressions. This
does reduce the initial time taken for the first few iterations but the time taken to evaluate
the compiled expression grows from 500us to 2100us toward the end of the loop (measured with
nanoTime() around the call to evaluate). There may be some issue with Xalan; the same behaviour
is seen with Sun's JAXP implementation included in JDK1.6 (which is based on Xalan).
> Use of ThreadLocals in this way is almost certainly going to trigger
> memory leaks on web application reload.

I think it could be made to work but agree that it's a *bad idea* for a tag to be doing this
and there has to be a better way.

I'm going to ping Xalan about the increase in time taken as expressions are evaluated as I
would assume I'm doing something silly.



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

View raw message