sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
Tomasz Kaszuba's Avatar

best way to deserialize xml


Question posted by: Tomasz Kaszuba (Guest) on November 11th, 2005 10:49 PM
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?


2 Answers Posted
Christoph Schittko [MVP]'s Avatar
Christoph Schittko [MVP] November 11th, 2005 10:49 PM
Guest - n/a Posts
#2: 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's Avatar
Guest - n/a Posts
#3: 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]


 
Not the answer you were looking for? Post your question . . .
196,809 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,809 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors