473,698 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to speed up the ReadXML?

Hi,

In my C# Windows Form project, I'm testing comparing using the SqlClient
with the ReadXML method.
The ReadXML method will read 2 .xml files, one is 4K, the other one is 3Mb,
both are on my PC's local drive.
However, I found that it takes approximately 9 seconds for the ReadXML
method, while the SqlClient method is about 2 seconds.
Now I have 2 quesitons here:
1. Is it possible to speed up the ReadXML?
2. When will my PC's erase DataSet's ReadXML memory?

Thanks for help.
Jason
Apr 1 '06 #1
2 2108
Jason,

ReadXML must parse the entire XML document before it can represent it
in a relational-like format, which uses a lot resources for large
documents. The SqlClient method will always be faster. There are a
number of ways to improve performance with XML data, see
http://msdn.microsoft.com/library/de...netchapt09.asp,
but I'm not sure these recomendations will help ReadXML.

Once your DataSet goes out of scope or you call Dispose() it will be
marked for garbage collection and the memory will be reclaimed.

-Carl

Apr 1 '06 #2
It should be noted that SqlClient will not always be faster than reading
an XML document. It depends on the size of the data, the structure, etc,
etc. Also, you have to consider the other factors in play here, namely, is
it appropriate to store this information in the database as opposed to a
config file which is most likely stored locally?

On top of that, it should be noted that calling Dispose on the DataSet
will not mark it for garbage collection. The Dispose pattern on the DataSet
is inherited from the MarshalByValueC omponent class, and the DataSet does
nothing to override that behavior. The only thing that calling Dispose on
the DataSet does is fire the Disposed event.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Carl" <cz******@gmail .com> wrote in message
news:11******** **************@ u72g2000cwu.goo glegroups.com.. .
Jason,

ReadXML must parse the entire XML document before it can represent it
in a relational-like format, which uses a lot resources for large
documents. The SqlClient method will always be faster. There are a
number of ways to improve performance with XML data, see
http://msdn.microsoft.com/library/de...netchapt09.asp,
but I'm not sure these recomendations will help ReadXML.

Once your DataSet goes out of scope or you call Dispose() it will be
marked for garbage collection and the memory will be reclaimed.

-Carl

Apr 1 '06 #3

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

Similar topics

11
408
by: DraguVaso | last post by:
Hi, I should use XML to synchronize the data from different (VB.NET) applications, and I was just wondering which Overloads of these functions ( ReadXmlSchema, ReadXml and WriteXml) goes the fastest? I don't think the ReadXMLSchema would give a lot of difference, but maybe the overlaods of ReadXml and WriteXml will. Especially with larges files/datatables... Should I use the IO.Stream? The XmlReader/XmlWriter?
1
4821
by: Jeffrey A. Voigt | last post by:
I'm having trouble loading some xml data into a dataset via the ReadXML call. I'm loading into the dataset an xml schema prior to the ReadXML call. I see that there IS in fact, 3 records that should be created in the dataset with the provided xml. However, after the ReadXML statement there are no rows in the DataSet.Tables ? IS there something I'm missing? I can assure you that the schema is correct, since it was originally created with...
1
5818
by: mr_dom_is | last post by:
Hi I have a little bit of trouble, probably missing the point now sure but: I have a dataset dim ds as new dataset("User") Which is populated with data from a database. When I use
8
5681
by: Nikhilesh Mehendale | last post by:
I have written a web service in C#, .NET 1.1 which reads a XML file into a dataset. This is just a plain XML file. First I use the Dataset.ReadXmlScheme function and pass the XML file to it. Then I convert data type of one of the column to integer and then I use the Dataset.ReadXml function and pass the same file to it. This works on my machine, but when I run it on a .NET 2.0 machine it thows an exception with message "Input string was...
1
2101
by: CB | last post by:
Using C# in .Net 2003, DataSet.ReadXml fails when a percentage (%) sign is in the filename followed by 2 hex characters. Seems that the % sign is likely encoding the following 2 hex characters. So c:\test%ab.xml fails for ReadXml since %ab is interpreted as 171 and c:\test171.xml does not exist. There is no problem with c:\test%mn.xml because "mn" is not a hex code. If I replace the % sign with %25 (25hex = 37dec = ascii code for %),...
5
2135
by: James Morton | last post by:
I have a Static DataSet in a class file that I am using globally between a few forms. The main form populates the dataset through a menu option which invokes ReadXML in the class file to populate the DataSet. The ReadXML is a rather lengthy operation with >5mb xml files (I am reading in the schema and ignoreschema on read). This has presented several problems 1) What kind of progress bar can I show during load since I can't increment...
3
2398
by: Raj Chudasama | last post by:
I am trying to read an xml file and have it view data in the datagrid. (For example take the xml file viewer in the visual studio, when u open an xml file it has that nice readable grid). I though that when i use the ReadXml funtion it will automatically read data and add the data to the datagrid. but i am wrong its not that simple. so i need help only with adding the data to the datagrid. this is what i have so far. I have created...
2
4817
by: C Glenn | last post by:
I'm attempting to use ReadXml. It's working in that I end up with some data in the DataSet. But I'm not able to deal with it effectively after that. The XML file is properly formatted in that it was created with WriteXML, so it contains the name of the table (I've inspected it to be sure). But after calling ReadXml the DataSet does not contain a table with the specified name. In fact, Tables does not contain a table corresponding to...
1
2381
by: ray well | last post by:
i saved the state of a data set and table via MyDs.WriteXmlSchema("MyDs.xsd") MyDs.WriteXml("MyDs.xml") i was able to read them back in and display the info in the database by MyDs.ReadXmlSchema("MyDs.xsd") MyDs.ReadXml("MyDs.xml")
0
8671
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9016
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8856
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5858
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4613
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2321
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1997
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.