ARTICLE

Performance comparison of XslTransform inputs

Posted by Daniel Stefanescu Articles | Visual Basic 2010 June 17, 2003
This article explains about the performance comparison of XslTranform Inputs. To transform XML into HTML for use on a Web site or to transform it into a document that contains only the fields required you could use the XSLTransform class (found in the System.Xml.Xsl namespace).
 
Reader Level:

Description.

To transform XML into HTML for use on a Web site or to transform it into a document that contains only the fields required you could use the XSLTransform class (found in the System.Xml.Xsl namespace). The XSL transformation uses as input document an XML document through three classes which implements XPathNavigator and IXPathNavigable interface: XmlDocument, XmlDataDocument and XPathDocument. 

XmlDocument class (found in the System.Xml namespace):

This class can be used in cases where a DOM structure must be edited first before XSL transformation. The class extends the XMLNode class. 

XMLDataDocument class (found in the System.Xml namespace):

This class extends the XMLDocument class and can be used when working with Datasets. Provides access either to relational data (through the overloaded method Load) or to XML data (LoadXML method) 

XPathDocument class (found in the System.Xml.XPath namespace):

This class does not extend the XMLNode class (as XMLDocument) but provides a read-only representation of a DOM structure and it is highly optimized for XSLT processing and the XPath data model using the XPath optimization functions on the XPathNavigator

So, I used the following scenario to test if the XPathDocument is the fastest way to input an XML document to the XSL transformation.

I applied the XSL transformation to the each class loaded with the same XML file and outputted the result to the web in an .aspx page.

oTrs.Load(Server.MapPath("portfolio3.xsl"))
oTrs.Transform(oDoc,
Nothing, sw)
TextBox1.Text = sw.ToString()
 

Each .aspx page was stressed with against Application Center Test in three different cases (1, 3 and 10 concurrent browser connections). The stress test was performed on 2 different machines and the test duration was 5 minutes.

// XMLDocument Test
Test.SendRequest("
http://xmldocument.aspx/")
// XMLDataDocument Test
Test.SendRequest("
http://XMLDataDocument.aspx")

// XPathDocument Test
Test.SendRequest("
http://XPathDocument.aspx")

The results (request vs. time) were identical in all cases.

Where:

  1. XPathDocument.
  2. XMLDataDocument.
  3. XMLDocument.

Conclusion:

XPathDocument provides the fastest option for transforming XML via XSLT because is optimized for XPath queries due to the internal storage.

share this article :
post comment
 
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor