Memory-usage DataSet compared to XML-file-size

D

dennis

I was wondering, if you load an XML-file into a DataSet,
how much memory will take this up, compared to the size
of the XML-file on disk ?

I'm curious because most of the size of a XML-file is taken
up by its tags. If you compress a XML-file into a ZIP-file,
it becomes about 8 ten times smaller.

So, if I load a 100 kB XML-file into a DataSet, will
it only take up about 20 or 30 kB of memory ?
 
N

Nicholas Paldino [.NET/C# MVP]

Dennis,

A formula of this kind isn't really possible, because implementation
details for parsers are different. Granted, the one parser in .NET that is
most commonly used is the XmlDocument in the System.Xml namespace, but the
implementation details are not known, and the internal representation of the
info set is not known as well. Considering what it takes to form a complete
object model and whatnot, I would not be surprized if it varied greatly from
document to document.

Also, you have to remember, that in some cases, the whitespace is
relevant in the XML document, and in others it is not, so just zipping it
and thinking that is going to be the size in memory is incorrect.

Hope this helps.
 
H

Harish Palaniappan

keeping it as an xml file is the option that takes the least memory at
runtime.

becos..
loading it to an xml document(XMLDOM) will create objects for every node on
the xml file.. and every object uses an amount of memory space that is
required to store the node's content (string content for end type nodes..
and child nodes for parent-type nodes)

and loading into a dataset is again going to convert the xml document into
tables -> rows -> and columns .. and content.. each being an object with a
specific type.

comparatively, xml document (XMLDOM Document) takes more runtime space and
is slower than datasets, if xml loaded is large... becos datasets implement
collection objects for rows and columns..

and still u have xmlReaders .. which use very less memory... but u cant
manipulate the xml with xmlreaders. if u r considering loading the xml to
display it or read it once.. xmlreader is the best option.

Personally i prefer datasets whenever implementation allows one.. instead of
xmldocument... they are highly workable.

'Harish.
 
D

dennis

I was wondering, if you load an XML-file into a DataSet,
how much memory will take this up, compared to the size
of the XML-file on disk ?

I'm curious because most of the size of a XML-file is taken
up by its tags. If you compress a XML-file into a ZIP-file,
it becomes about 8 ten times smaller.

So, if I load a 100 kB XML-file into a DataSet, will
it only take up about 20 or 30 kB of memory ?

Thanks for your answers, but I gues i didn't make myself
clear. By 'loading an XML-file into a DataSet', I meant
doing it like this : myDataSet.ReadXml(myXMLfile))

This does not create much overhead, does it ?
 
R

Ravichandran J.V.

Apart fro size, a dataset is useful in the context of performance. A
DataSet is a performance-oriented object and its occupancy of memory may
seem trivial to many who actually use it.

with regards,


J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com
 
D

dennis

Apart fro size, a dataset is useful in the context of performance.
A DataSet is a performance-oriented object and its occupancy of
memory may seem trivial to many who actually use it.

I asking this question because I'm in doubt wheter I must put
my DataSets into Session-variables or just read them anytime/
anyplace I need them.

I like the Session-idea, but I don't want the server to run out of
memory when there are many users logged on at the same time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top