My purposes in doing this test was to provide a lower bound on our performance; we can not be faster then executing a simple transform which copies input to output. Taking advantage of the built-in identity transform wouldn't not support this evaluation.
We use the output DOM, because from this stage we will both (a) serialize the output to a file and (b) apply a second transformation to the output DOM.
The input DOM may not be strictly necessary for actual operation; we get our input as a byte-array and I could use a stream source for the input. However, for purposes of evaluating and isolating the different contributors to the performance, I wanted to separate the time to parse the input XML from the time to transform the input XML.
From my perspective (unless I'm missing something which is why I posted here), this copy transform should represent the lower bound on our performance.
Santiago Pericas-Geertsen wrote:
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]
-- Edward L. Knoll Phone (FedEx) : (719)484-2717 e-mail (FedEx) : [EMAIL PROTECTED] e-mail (personal) : [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
