Thursday, February 16, 2006

 

Default performance of Data.ReadXMLData.ReadXML

The System.Data.DataSet class provides great flexibility for disconnected access to data. Its capabilities to transform data into XML and to read data from XML come in very handy.
Example


0
0.703552246887028
0.993569961746023
0.147870197961046
0.740130904009627



1
0.378916004383432
0.143134204737439
0.419504510434114
0.403854837363518

..........
If I have 100 rows in this document, it takes 90 milliseconds to read the XML document into the DataSet using ReadXML().[*] If I have 1,000 rows, it takes 200 milliseconds. Not too bad. But if I have 5,000 rows, it takes 5,700 milliseconds. Finally, if I have 10,000 rows, it takes an objectionable 24,295 milliseconds (about 25 seconds).What problem ?

Solutions :
Preload the schema into the DataSet before calling ReadXML(). It makes a significant difference in performance as the XML file size grows. This eliminates the time taken by ReadXML() to infer the schema from the XML document.

Comments: Post a Comment

Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?