Groups | Blog | Home
all groups > dotnet xml > january 2006 >

dotnet xml : BinaryFormatter slower than DataTable.Save!?


windsurfing_stew NO[at]SPAM yahoo.com.au
1/17/2006 9:09:15 PM
Hi All,

I was saving a DataTable out to disk using DataTable.Save(). Later
loading it with DataTable.Load().

In order to get greater performance I replaced these two calls with
BinaryFormatter.Serialize() and BindaryFormatter.DeSerialize. Both of
these used a FileStream to work with files. Strangely this binary
formatting is about 3x slower than the DataTable's native Save()
method.

Anyone got any thoughts on this? I would have thought Binary
Formatting to be faster than Xml Formatting. Any further suggestions
for performance gains?

Stewart
windsurfing_stew NO[at]SPAM yahoo.com.au
1/17/2006 9:14:00 PM
Where I've referred to DataTable Save() and Load(), I meant to say
WriteXml() and ReadXml().
NuTcAsE
1/18/2006 8:35:27 AM
This is a known behavior in 1.1. Binary serialization of
datasets/datatables is realy slow because internally the dataset object
implements the ISerializable interface which first serializes the data
into xml (using diffgram) and then to the binary format. No
optimaization and compression is done.

This has been fixed in 2.0 where datasets and datatables have native
support for binary serialization.

Read more here..
http://msdn.microsoft.com/msdnmag/issues/04/10/CuttingEdge/

- NuTcAsE
windsurfing_stew NO[at]SPAM yahoo.com.au
1/18/2006 2:18:01 PM
Thanks, however this is in 2.0 that I'm experiencing the issue.
NuTcAsE
1/19/2006 9:20:59 AM
Even after setting the data set / data table to use binary
serialization by setting the SerialziationFormat?
AddThis Social Bookmark Button