BinaryFormatter slower than DataTable.Save!?

  • Thread starter Thread starter windsurfing_stew
  • Start date Start date
W

windsurfing_stew

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
 
Where I've referred to DataTable Save() and Load(), I meant to say
WriteXml() and ReadXml().
 
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
 
Thanks, however this is in 2.0 that I'm experiencing the issue.
 
Even after setting the data set / data table to use binary
serialization by setting the SerialziationFormat?
 

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

Back
Top