Connecting Tech Pros Worldwide Forums | Help | Site Map

best way to deserialize xml

Tomasz Kaszuba
Guest
 
Posts: n/a
#1: Nov 11 '05
I'm at a quandry as to what's the best/fastest way to deserialize an
incoming xml stream?

I ran a small test on xmlserializer and on a small file it performed 10
times worse then when I used the XMLDocument and deserialized the values
myself. Is the xmlserializer really that slow?

I'm expecting a file about 1 MB in length and if it's that slow on a 2 K
file then I can't phantom how it's going to behave on a 1 MB file.

Should I just skip the xmlserializer and XML Dom and go straight to
xmlreader and do the deserialization myself?



Christoph Schittko [MVP]
Guest
 
Posts: n/a
#2: Nov 11 '05

re: best way to deserialize xml


This has been discussed a few times. The bmost expensive operation is the
initial instantiation of an XmlSerializer for a certain type, make sure you
design around that. Check the archives [0] for more on that topic.


--
HTH
Christoph Schittko [MVP]
Software Architect, .NET Mentor

[0] http://groups.google.com

"Tomasz Kaszuba" <tomasz.kaszuba@N!O!inteligoS!P!A!M.pl> wrote in message
news:OIFKC#GTDHA.212@TK2MSFTNGP10.phx.gbl...[color=blue]
> I'm at a quandry as to what's the best/fastest way to deserialize an
> incoming xml stream?
>
> I ran a small test on xmlserializer and on a small file it performed 10
> times worse then when I used the XMLDocument and deserialized the values
> myself. Is the xmlserializer really that slow?
>
> I'm expecting a file about 1 MB in length and if it's that slow on a 2 K
> file then I can't phantom how it's going to behave on a 1 MB file.
>
> Should I just skip the xmlserializer and XML Dom and go straight to
> xmlreader and do the deserialization myself?
>
>[/color]


Chris Lovett
Guest
 
Posts: n/a
#3: Nov 11 '05

re: best way to deserialize xml


The serializer is only slow the first time you call it. The reason for
this is that it actually generates code to do the serialization, then
compiles that code. Then the compiled code flies.

"Tomasz Kaszuba" <tomasz.kaszuba@N!O!inteligoS!P!A!M.pl> wrote in message
news:OIFKC%23GTDHA.212@TK2MSFTNGP10.phx.gbl...[color=blue]
> I'm at a quandry as to what's the best/fastest way to deserialize an
> incoming xml stream?
>
> I ran a small test on xmlserializer and on a small file it performed 10
> times worse then when I used the XMLDocument and deserialized the values
> myself. Is the xmlserializer really that slow?
>
> I'm expecting a file about 1 MB in length and if it's that slow on a 2 K
> file then I can't phantom how it's going to behave on a 1 MB file.
>
> Should I just skip the xmlserializer and XML Dom and go straight to
> xmlreader and do the deserialization myself?
>
>[/color]


Closed Thread