472,789 Members | 1,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,789 software developers and data experts.

XMLDocument.Load() performance

I've got an app that has hundreds of medium-sized (100s of elements) XML
files on disk (not in db). Right now these are loaded via XMLDocument.Load
and searched with XPATH.

The performance has become unacceptable.

Performance improvment strategies I know of:

1. Switching to XMLReader

2. general System.XML 2.0 speed improvements

3. SQL Server 2005 : putting the XML in the XML Data Type and :
(a) doing XPATH directly against the DB
(b) loading the XML from the DB into an XMLDocument and doing XPATH against
it

Can anyone provide more information? What type of speed improvements can be
expected?

I've read that with System.XML 1.0 you can expect about 30-40% improvement
by switching to XMLReader techniques.

Nov 12 '05 #1
1 4225
John A Grandy wrote:
I've got an app that has hundreds of medium-sized (100s of elements) XML
files on disk (not in db). Right now these are loaded via XMLDocument.Load
and searched with XPATH.

The performance has become unacceptable.

Performance improvment strategies I know of:

1. Switching to XMLReader

2. general System.XML 2.0 speed improvements

3. SQL Server 2005 : putting the XML in the XML Data Type and :
(a) doing XPATH directly against the DB
(b) loading the XML from the DB into an XMLDocument and doing XPATH against

XmlReader doewsn't support XPath queries. Switch to System.XML 2.0 is
certanly a good idea.
Usual optimizations are:
1. Use XPathDocument instead. It's 30-50% faster than XmlDocument when
it comes to XPath or XSLT, because it's explicitly optimized for XPath
queries.
2. Optimize your XPath expressions. Never use "//" but "descandant::"
instead etc.
3. If your queries are homogeneous you can get amazing performance boost
by indexing XML in-memory using IndexingXPathNavigator, see
http://msdn.microsoft.com/XML/Buildi...MLindexing.asp
4. If you can limit XPath to forward only subset, you can use
XPathReader, which is XPath-aware XmlReader.

--
Oleg Tkachenko [XML MVP, MCAD]
http://www.xmllab.net
http://blog.tkachenko.com
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ayende Rahien | last post by:
Serious problem I'm using Chris Lovett's SgmlReader class SgmlReader sr = new SgmlReader(); XmlDocument xdoc = new XmlDocument(); sr.DocType = "HTML"; sr.InputStream = new...
5
by: John Bailo | last post by:
I wrote a webservice to output a report file. The fields of the report are formatted based on information in an in-memory XmlDocument. As each row of a SqlDataReader are looped through, a...
5
by: KathyB | last post by:
If someone could just explain this to me...I just don't get it! I have an aspx page where I retrieve several session variables and use xmlDocument to transform xml file with xsl file into an...
1
by: Colin Green | last post by:
Hi I wonder if anyone has any ideas about this... I am dumping the contents of an XmlDocument into a RichTextBox so the user can see the raw XML. I use a line of code something like this to lado...
2
by: Graham Pengelly | last post by:
Hi I am trying to transform on System.Xml.XmlDocument into another using XslTransform without writing the object out to a file. I am guessing it should work something like this... public...
1
by: Zeng | last post by:
Hello, I have profiled my code, and the current performance bottleneck is this routine. It gets called 7400 times to do some intensive calculations when a user uses the feature. The xmlText...
5
by: Rob Panosh | last post by:
Hello, I am trying to create a xmlDocument from as dataset. My code is listed below. All seems to go well until xmlDocument.Load(CType(ms, System.IO.Stream)) ... I keep getting the following...
5
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... I've been trying to improve the performance of our xml handling, so I've been doing some timing tests lately and ran across something I thought odd - XPathDocument seems slightly slower...
4
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... We've got a lot of places in our code where we read relatively small xml user preference blocks. Currently that's creating a new XmlDocument in every spot. I was thinking we might see...
0
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.