DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1205>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1205

TransformerHandler not reusable





------- Additional Comments From [EMAIL PROTECTED]  2002-10-21 08:15 
-------
Thanks Pavel,
I tried your suggestion but I can't get it to work. Here's why.

Calling reset() and then getInputContentHandler() on a TransformerImpl that's 
not brand new, yields the same result as before. NullPointerException the 
second time.

Looking at the source for newTransformerHandler, I can see that this code 
creates a new Transformer every time (using a Template). So even if it does 
call getInputContentHandler(), it does this on a fresh TransformerImpl.

Should I get to work, the code will break if I use a 
org.apache.xalan.xsltc.trax.TransformerImpl since I'm forced to use an explicit 
implementation rather than standard JAXP. Right now, I'm happy to circumvein 
this using "instanceof" or something but it sure would be nice to have a 
working JAXP implementation.

I made some performance measurements (not very scientific, I run 1000 
transformations in a loop and measure using System.currentTimeMillis).

Using Xalan 2.4.0 and XSLTC, the average time for a transformation on my laptop 
is 14 millisecs with a fairly simple XSL. 10 millisecs (> 70%) is spent in 
TransformerFactory.newTransformerHandler(Templates tps)! If I don't use XSLT, 
the corresponding numbers are 20 millisecs per transformation, still with 10 
millisecs in the call to newTransformerHandler() (50%). So there really is a 
need for a reusable TransformerHandler or for some serious performance 
optimizations in the reuse of templates.

Reply via email to