You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by bu...@apache.org on 2001/09/10 11:16:37 UTC
[DO NOT REPLY: Bug 3514] New:
computational (recursive) template is very slow compared to xalan 1.2.2
PLEASE DO NOT REPLY TO THIS MESSAGE. TO FURTHER COMMENT
ON THE STATUS OF THIS BUG PLEASE FOLLOW THE LINK BELOW
AND USE THE ON-LINE APPLICATION. REPLYING TO THIS MESSAGE
DOES NOT UPDATE THE DATABASE, AND SO YOUR COMMENT WILL
BE LOST SOMEWHERE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3514
*** shadow/3514 Mon Sep 10 02:16:37 2001
--- shadow/3514.tmp.6080 Mon Sep 10 02:16:37 2001
***************
*** 0 ****
--- 1,142 ----
+ +============================================================================+
+ | computational (recursive) template is very slow compared to xalan 1.2.2 |
+ +----------------------------------------------------------------------------+
+ | Bug #: 3514 Product: XalanJ2 |
+ | Status: NEW Version: 2.2.x |
+ | Resolution: Platform: PC |
+ | Severity: Critical OS/Version: Windows NT/2K |
+ | Priority: Other Component: Xalan |
+ +----------------------------------------------------------------------------+
+ | Assigned To: xalan-dev@xml.apache.org |
+ | Reported By: c.mallwitz@intershop.de |
+ | CC list: Cc: |
+ +----------------------------------------------------------------------------+
+ | URL: |
+ +============================================================================+
+ | DESCRIPTION |
+ computational (recursive) template is very slow in xalan-j 2.2.x (and 2.1.0)
+ compared to xalan 1.2.2. I use the following script where both jars (xalan and
+ xerces) come from the refered xalan package.
+
+ ----------------------------------------
+ set JAVA_HOME=c:\java\jdk1.3.0
+ set XALAN=%JAVA_HOME%\bin\java.exe org.apache.xalan.xslt.Process
+
+ set CLASSPATH=xalan_1.2.2_xalan.jar;xalan_1.2.2_xerces.jar
+ %XALAN% -IN xalan-1.xml -XSL xalan-1.xslt -OUT result-1.xml
+
+ set CLASSPATH=xalan_2.2.D10_xalan.jar;xalan_2.2.D10_xerces.jar
+ %XALAN% -DIAG -IN xalan-1.xml -XSL xalan-1.xslt -OUT result-1.xml
+ ----------------------------------------
+
+ this gives me:
+
+ ========= Parsing file:c:/Java/test/xalan-1.xslt ==========
+ Parse of file:c:/Java/test/xalan-1.xslt took 741 milliseconds
+ ========= Parsing file:c:/Java/test/xalan-1.xml ==========
+ Parse of file:c:/Java/test/xalan-1.xml took 120 milliseconds
+ =============================
+ Transforming...
+ transform took 181 milliseconds
+ XSLProcessor: done
+
+ ========
+ Transform of xalan-1.xml via xalan-1.xslt took 2334 ms
+
+ The number for xalan-j 2.2.x increases faster than linear with the number of
+ elements in the xml source. I hope that I don't do anything bad in my xslt but
+ moving to a new version should not decrease performance so badly ...
+
+ xml data example:
+ ----------------------------------------
+ <?xml version="1.0"?>
+ <foo>
+ <x id="A1"> <z> 3</z></x>
+ <x id="A2"> <z>11</z></x>
+ <x id="A3"> <z>13</z></x>
+ <x id="A4"> <z> 7</z></x>
+ <x id="A5"> <z> 1</z></x>
+ <x id="A6"> <z> 5</z></x>
+ <x id="A7"> <z> 0</z></x>
+ <x id="A8"> <z>16</z></x>
+ <x id="A9"> <z>13</z></x>
+ <x id="A10"><z>11</z></x>
+ <x id="A11"><z> 3</z></x>
+ <x id="A12"><z> 6</z></x>
+ <x id="A13"><z> 2</z></x>
+ <x id="A14"><z> 7</z></x>
+ <x id="A15"><z> 1</z></x>
+ <x id="A16"><z>13</z></x>
+ <x id="A17"><z>10</z></x>
+ <x id="A18"><z> 2</z></x>
+ <x id="A19"><z>14</z></x>
+ <x id="A20"><z>11</z></x>
+ <x id="A21"><z> 3</z></x>
+ <x id="A22"><z>11</z></x>
+ <x id="A23"><z>13</z></x>
+ <x id="A24"><z> 7</z></x>
+ <x id="A25"><z> 1</z></x>
+ <x id="A26"><z> 5</z></x>
+ <x id="A27"><z> 0</z></x>
+ <x id="A28"><z>16</z></x>
+ <x id="A29"><z> 0</z></x>
+ <x id="A30"><z>11</z></x>
+ <x id="A31"><z> 9</z></x>
+ <x id="A32"><z> 3</z></x>
+ <x id="A33"><z> 4</z></x>
+ <x id="A34"><z> 7</z></x>
+ <x id="A35"><z> 1</z></x>
+ <x id="A36"><z> 8</z></x>
+ <x id="A37"><z>10</z></x>
+ <x id="A38"><z> 2</z></x>
+ <x id="A39"><z>17</z></x>
+ <x id="A40"><z>11</z></x>
+ </foo>
+ ----------------------------------------
+
+ xslt example:
+ ----------------------------------------
+ <?xml version="1.0"?>
+ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:template match="/foo">
+ <foo>
+ <xsl:variable name="max">
+ <xsl:call-template name="max">
+ <xsl:with-param name="list" select="x"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:value-of select="$max"/>
+ </foo>
+ </xsl:template>
+
+ <xsl:template name="max">
+ <xsl:param name="list"/>
+
+ <xsl:choose>
+ <xsl:when test="$list">
+ <xsl:variable name="remaining-max">
+ <xsl:call-template name="max">
+ <xsl:with-param name="list" select="$list[position()!=1]"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:variable name="max" select="$list[1]/z"/>
+ <xsl:variable name="max" select="substring($max, string-length
+ ($max)-3)"/>
+
+ <xsl:choose>
+ <xsl:when test="$max > $remaining-max"><xsl:value-of
+ select="$max"/></xsl:when>
+ <xsl:otherwise><xsl:value-of select="$remaining-
+ max"/></xsl:otherwise>
+ </xsl:choose>
+
+ </xsl:when>
+ <xsl:otherwise>0</xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ </xsl:stylesheet>
+ ----------------------------------------