DataSet.ReadXml on Netcf--Code runs on both Desktop and WinCe

G

Guest

I am still pursuing why the DataSet.ReadXml() is so slow on the WinCe device
(a Sh4 running at 400mhz). I remembered that Netcf App's will run on the
Desktop so using Environment.TickCount I did a simple benchmarking of
ReadXml, displaying the milliseconds in a MessageBox. I ran the code
standalone (not under the debugger) in both the WinCe device and the Desktop.
The WinCe runs at about 400mhz and the Desktop at about 1.8ghz (4.5 times
faster). I found that the load time on the Desktop was about 337 times faster
then on the WinCe device. I did not expect this. I assumed that the slowness
of the Netcf ReadXml() was a combination of the processor speed and the
"simplified" nature of the Netcf code. Apparently not. It appears that the
"slowness" lies mainly with aspects of the WinCe device other then raw
processor speed and not much with the difference between Net and Netcf code.

Is this correct?

Thanks.

--John Olbert
(e-mail address removed)
 
I

Ilya Tumanov [MS]

1. Desktop runs at 1.8 GHz, device at 0.4 GHz. (x4.5)

2. Desktop can execute 3-4 commands per cycle; device can execute one or
less (x3-5)

3. Desktop has 64 (128 for dual channel) bit DDR/DDR2 memory; device
probably has 16 or 32 bit SDR @100MHz. (x50 on memory moves).

4. Desktop is CISC, device is RISC, CISC commands are shorter on average due
to variable length and each does more. That hits device hard because of tiny
cache and very slow memory. (x2)

5. Desktop uses highly optimized JIT; device uses fast compact JIT which
produces especially slow code on NETCF V1 non-ARM CPUs. (x10)



Let's see: 4.5x4x2x10 = 360. Sounds about right.



By the way, code for ReadXml() was optimized in NETCF V1 SP2 (current
version is SP3), it's about twice as fast as in RTM.

JIT was optimized and unified for all CPUs in NETCF V2 and is about twice as
fast for ARM (which was already fastest in V1).

You might get x5 gain for SH4 with NETCF V2 or even more.



Now, you also could optimize ReadXml():



1. Make sure schema is preloaded into data set, no schema means inference
and that is very slow.

2. Map columns to attributes and use related tables, not nested. I've posted
utility to make this change for existing XML/Schema, please use search below
if you interested.

3. Avoid DateTime columns as they are very slow to parse. If you need
DateTime, consider passing ticks instead.



Keep in mind it would never be as fast as desktop, but you should be able to
make speed acceptable.


--
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

Guest

That's got to be the best, most concise explanation of why a device is
slower than a desktop that I've ever heard. Well said!

-Chris


Ilya Tumanov said:
1. Desktop runs at 1.8 GHz, device at 0.4 GHz. (x4.5)

2. Desktop can execute 3-4 commands per cycle; device can execute one or
less (x3-5)

3. Desktop has 64 (128 for dual channel) bit DDR/DDR2 memory; device
probably has 16 or 32 bit SDR @100MHz. (x50 on memory moves).

4. Desktop is CISC, device is RISC, CISC commands are shorter on average
due to variable length and each does more. That hits device hard because
of tiny cache and very slow memory. (x2)

5. Desktop uses highly optimized JIT; device uses fast compact JIT which
produces especially slow code on NETCF V1 non-ARM CPUs. (x10)



Let's see: 4.5x4x2x10 = 360. Sounds about right.



By the way, code for ReadXml() was optimized in NETCF V1 SP2 (current
version is SP3), it's about twice as fast as in RTM.

JIT was optimized and unified for all CPUs in NETCF V2 and is about twice
as fast for ARM (which was already fastest in V1).

You might get x5 gain for SH4 with NETCF V2 or even more.



Now, you also could optimize ReadXml():



1. Make sure schema is preloaded into data set, no schema means inference
and that is very slow.

2. Map columns to attributes and use related tables, not nested. I've
posted utility to make this change for existing XML/Schema, please use
search below if you interested.

3. Avoid DateTime columns as they are very slow to parse. If you need
DateTime, consider passing ticks instead.



Keep in mind it would never be as fast as desktop, but you should be able
to make speed acceptable.


--
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).
 

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