Serialization Performance (again)

  • Thread starter Thread starter Joe
  • Start date Start date
J

Joe

Hi again,

I used a profiler like recommended and found that the majority of time is
spent on WriteArrayMember. I have around 15 classes that inherit from
CollectionBase. ObjectWriter.GetType is taking .3468 seconds and
System.GetType is taking .4340 seconds.

I would expect GetType to return much quick.

I was reading somewhere that overriding GetHashCode() can help.
Is there a way to specify the type that is contained within the
CollectionBase.InnerList?

Thanks for any help,
Joe
 
There's no way to change the type used by CollectionBase, but you can always
write a collection from scratch to do it.

You might want to take a look at CodeSmith: http://www.codesmithtools.com/

I use it for generating custom collections all the time.

Pete
 
Hi Joe,

Thanks for Pete's reply. I just wanted to check how things are going and
whether or not Pete's suggestin is helpful for you.

If there is any question, please feel free to join the community and we are
here to support you at your convenience. Thanks again and have a nice day.

Best Regards,

Terry Fei[MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Hi Terry,

Thanks Pete for you reply!

I can create my own collection base class if needed. I guess my main
questions are will it help and why is the performance so bad? If I have to
create a collection class for each of my collections than it defeats the
purpose of having a collection base class.

If I understand the way serialization works, GetType() is called on each
object in the array to find out what object type it is. Once it knows this
it serializes that object.

The strange thing is the performance is excellent on a Windows 2003 server
(regardless of the edition) but any other OS like Windows 2k or Windows XP
the performance is very, very bad. I've tried 4 different servers and 4
different XP machines and 2 Windows 2k machine and the results are pretty
much the same.
To give you an idea on the difference a server OS take < 2 seconds to
serialize and object and the XP and 2000 machines take ~2 minutes.
These are not super servers. In fact one of them is an identical hardware
match to one of the XP machines.

In any case I'm going to test out a custom collection base and see what
happens.

Thanks again,
Joe
 
Hi Joe,
Thanks for your feedback!

In this scenario, I hope you could send a simplified sample to us so that
we can test performance on our machine, which will help us get closer to
find bottleneck. So I appreciate your time in performing them.

If you have any further information related to this problem, please feel
free to post here.
Thanks very much and looking forward to hearing from you.

Best Regards,

Terry Fei[MSFT]
Microsoft Community Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Back
Top