Serializable overhead

  • Thread starter Thread starter Frank Rizzo
  • Start date Start date
F

Frank Rizzo

What is the performance impact of setting a [Serializable] attribute on
a class? Is there a performance win if I remove the attribute?

I am doing some perf profiling and realized that all my strongly type
collections generated by CodeSmith have a [Serializable] attribute on
them.

Thanks
 
IMHO, no. The serializable attribute mearly denotes that the class can
be serialized and will only be utilized if passed to a Serializer
(binary or xml). Think of it as a shortcut to actually implementing the
ISerializable interface.

Implementing interfaces, AFAIK, is "pretty much" free in terms of
performance. Unless, of course, you are implementing many interfaces
that in turn implement many interfaces themselves, then I would think
you would see a hit. But generally speaking, most the of the core .Net
interfaces are built around performance and wouldn't do that. :-)

HTH,
~d
 
Back
Top