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=13579>.
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=13579

Performance problem with Xalan 2.0 -> 2.4

           Summary: Performance problem with Xalan 2.0 -> 2.4
           Product: XalanJ2
           Version: 2.4
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: org.apache.xalan
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


When trying out xalan 2.4 I see a large performance problem with
my application.

My application :
I use domify (http://domify.sourceforge.net/) to build a DOM tree from
a JavaBean hierarchy. The DOM tree is build 'lazy'.  That is : Only when
the elements are needed they are created. 

The hierary is as follows:
RegistrationRoot  
  +--RegistrationYear
       +---RegistrationProductionLine
             +---RegistrationYear
                   +---RegistrationMonth
                         +---RegistrationBatch

- RegistrationRoot has a number of RegistrationYear(s).
- RegistrationYear has a number of RegistrationProductionLine(s)
- etc.
- RegistrationYear has an element "Year".

My XSLT:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
  <xsl:output method="html"/>

  <xsl:template match="/">
    <xsl:apply-templates select="RegistrationRoot"/>
  </xsl:template>

  <xsl:template match="RegistrationRoot">
  </xsl:template>

</xsl:stylesheet>

(I know this stylesheet does nothing, but it's good for showing the problem)

My problem:
In myXSLT you see that I only apply a template to RegistrationRoot.
So in my opinion it is not necessary to visit the children of the
RegistrationRoot element.

It seems that during the transformation xalan 2.4 visits each and every element of
the DOM-tree. This behaviour is not found in xalan 2.0 ! (The perfomance degradation
i'm experiencing is that now all my 'lazy' elements are instantiated !)

I printed out a stacktrace when the element "RegistrationMonth" is visited.
Its shows that the xalan-program is walking the tree (and not domify). So this is to
show that domify is not the problem. I think xalan is.

java.lang.Throwable
        at 
gti.batch.registration.RegistrationMonth.getBatches(RegistrationMonth.java:74)
        at java.lang.reflect.Method.invoke(Native Method)
        at
org.infohazard.domify.ElementAdapter$MethodNodeListAdapter.item(ElementAdapter.java:89)
        at org.infohazard.domify.NodeAdapter.getNextSibling(NodeAdapter.java:151)
        at org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.nextNode(DOM2DTM.java:421)
        at org.apache.xml.dtm.ref.DTMDefaultBase._nextsib(DTMDefaultBase.java:560)
        at 
org.apache.xml.dtm.ref.DTMDefaultBase.getNextSibling(DTMDefaultBase.java:1057)
        at
org.apache.xml.dtm.ref.DTMDefaultBaseTraversers$ChildTraverser.next(DTMDefaultBaseTraversers.java:472)
        at 
org.apache.xpath.axes.ChildTestIterator.getNextNode(ChildTestIterator.java:124)
        at org.apache.xpath.axes.BasicTestIterator.nextNode(BasicTestIterator.java:150)
        at org.apache.xpath.axes.NodeSequence.nextNode(NodeSequence.java:320)
        at
org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:311)
        at
org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:216)
        at
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2331)
        at
org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2152)
        at
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1205)
        at 
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:660)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1121)
        at
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1099)
        at Test2.execute(Test2.java:54)
        at Test2.main(Test2.java:161)


So basically my problem is :
- When transforming a document xalan visits each and every node of the DOM-tree,
even
  when my XPath-query only operates on the first children of the root-element. 


Kees Kuip.

Reply via email to