On Sep 27, 2004, at 3:17 PM, Edward L. Knoll wrote:
I'm running on a Sun/Solaris platform. We're running Xalan-J 2.4 and JDK 1.4. Our Java program does the following:
- loads the XSL style sheet into a javax.xml.transform.Templates,
- loads the XML file into a javax.xml.transform.dom.DOMSource
- transforms the DOMSource into a javax.xml.transform.dom.DOMResult
using javax.xml.transform.Transformer
- serializes the DOMResult to an output file using org.apache.xml.serializer.Serializer
Do you really need all these steps? This will create 3 DOMs in memory, the input, the output and the internal one created by Xalan (DTM). Seems unnecessary, but I don't know exactly what the app is doing.
The core template we're using for the copy is the following:
<xsl:template name="CopyAll" match="*"> <xsl:copy> <xsl:copy-of select="@*" /> <xsl:apply-templates /> </xsl:copy> </xsl:template>
Could you use the built-in identity transform instead? Not the same as the stylesheet above, but may have the same outcome depending on the XML files that you're processing --note that using the built-in identity transform will not require the creation of a DTM.
Following is a breakdown on the performance: - loading the stylesheet : 1.7 seconds - loading XML file : 0.3 seconds - creating Transform instance from Transforms: <0.1 seconds - serializing to output file: 0.4 seconds - executing copy transform: 2.1 seconds
Are these averages of multiple runs? These are awfully high numbers. Have you run this 100 or more times dropping the first few iterations to exclude class loading, etc.?
-- Santiago
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
