ReadXML Speed

G

Guest

hi,
I use at WebServices to get data to the PPC from the database server (via
Wlan). I use the following code:

Dataset1 = Ws.GetData1();

This take about 45 second. Too speed this up I tried to save the dataset to
XML file and read the file instead of using the webservices. I use this code:

Write dataset:
dataset1.WriteXml("data.xml")

Read dataset:
dataset1.ReadXml("data.xml");

To write the dataset to xml file goes fast, but to read the xml file takes
about 50 second.

Do anybody have an solution that give an better performance.

Regards
Karl-Inge Reknes
 
A

Alex Feinman [MVP]

To improve ReadXml speed you need to use schema. Save schema of your dataset
once using WriteXmlSchema. Then, before calling ReadXml, call ReadXmlSchema
to load schema. This will ensure much faster XML load. I prefer to store
schemas in assembly resource
 
G

Guest

Tanks!

I have tried this code:

DataSet1.WriteXmlSchema("\\Program Files\\norbitPPC\\grunndata.xsd");
DataSet1.WriteXml("\\Program Files\\norbitPPC\\grunndata.xml");

DataSet dsTemp = new DataSet();
dsTemp.ReadXmlSchema("\\Program Files\\norbitPPC\\grunndata.xsd");
dsTemp.ReadXml("\\Program Files\\norbitPPC\\grunndata.xml");

DateSet1 = dsTemp;

To read the XML takes now about 17 sec. Is this the most efficient way?

Karl-Inge Reknes
 
G

Guest

The XML file is 330 byte and the XSD file i 1,18 kB. I use Symbol PPC MC9060
with 64MB ram.

Karl-Inge Reknes
 
I

Ilya Tumanov [MS]

That can't be right. Such a small file will be loaded in under a second with
or without schema.

The very fact you see the performance improvements with schema suggests your
file is way bigger than 330 bytes.



Our tests indicate ~1 MB of data (1200 records of 33 fields of various types
in 3 nested tables) would be loaded in about 22 second with schema and in
about 75 seconds without it on PXA 255-400 MHz device running PPC 03 and CF
V1 SP3.



If you're measuring first pass, it would be few seconds longer as
Data/Schema code would be JITed.


Best regards,



Ilya



This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
S

Sachin Palewar

That was a nice benchmark info Ilya. But I am just curious about using
a CSV text file instead of XML file. Do you have some performance
benchmark info if I decide to use CSV instead of XML file with same
data. I am interested in CSV because I feel a CSV containing same data
will be much small than an XML file.

Looking forward to your reply...

Sachin
 
I

Ilya Tumanov [MS]

CSV will be faster than XML as it's very easy to parse and it does not carry
extra tag information.

How much faster? That depends on XML.



If you have many nested tables and columns are mapped as elements - may be a
lot faster.

If you're using related tables and all columns are mapped as attributes -
may be somewhat faster.



Since NETCF does not offer CSV support, we do not have performance data on
it.

You could try using OpenNETCF CSV adapter and see if performance is OK.



Best regards,



Ilya



This posting is provided "AS IS" with no warranties, and confers no rights.



*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
G

Ginny Caughey [MVP]

As Ilya says, it despends on the XML. With the Northwind customers and
orders tables, it is about twice as fast using beta 2 of .NetCFv2. I haven't
done any benchmarking with version 1, but since XML parsing is faster in
version 2, I'd guess the speed improvement would be even greater with
..NetCFv1.

Ginny Caughey
..NET Compact Framework MVP
 
S

Sachin Palewar

Thanks for response Ginny. You mean to say I can not develop any of
these 2 in vb.net?

1. Activesync Provider
2. Activesync File Filter
 

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