Knowing how XML parsing speeds compare to accessing data
from a relational database is important when determining the architecture
of an application especially since XML can be useful in many situations.
While certainly not scientific, this application shows basic performance
results of accessing data from the following sources:
- A SQL Server 2000 database (Northwind"s Customers table is queried)
using ADO.NET
- An XML document (element-centric) using the XmlTextReader
- An XML document (attribute-centric) using the XmlTextReader
- An XML document (element-centric) using the XmlDocument and XPath
- An XML document (attribute-centric) using the XmlDocument and XPath
The XML documents are stored on the web server file system and contain
the exact same data held in the Northwind database"s Customers
table. One XML document marks-up the table fields as elements while the
other marks-up the table fields as attributes. Each of the tests select
the CustomerID and ContactName fields/elements/attributes
(as appropriate) from the data source. After running the sample application
scroll down to the "Trace Information" section to view the results
of each test (refresh to view more accurate averages).
It"s important to understand that this application simply provides a
base-line comparison of using database and XML APIs and is by no means
a highly-structured and controlled performance test. The location of the
database and XML documents in relation to the web server can greatly affect
performance results. For this example the database is on a separate server
from the web server while the XML documents are stored directly on the
web server.
|