Our client/server app uses a NetDataContractSerializer to serialize arbitrary Serializable objects.
The output of BinaryFormatter would be somewhat smaller, performance however isn't really better.
Now smaller representations are possible (e.g. the outputs of XmlSerializer and DataContractSerializer, Json, Protocol Buffers, Thrift, etc.), that also happen to serialize and deserialize much faster.
However, in order to use those I'd have to go to every single one of the Serializable classes and add attributes and potentially change access levels of fields etc. Not only are these classes spread over many different internal projects, but our clients have their own dlls with Serializable classes which would have to be modified. In other words, a major undertaking.
Is there any other performance improvement, and potential size reduction (other than gzipping etc.), possible for Serializable objects?
 
                        
Many of those serializers do not require custom attributes - in fact some are specifically designed to recognize and work with
SerializableAttribute. See, for example:SerializableAttributeDataContractAttribute(which more accurately defines the characteristics you'd want in a wire protocol anyways). You could certainly configure protobuf-net at runtime to do what you want.Json.NET example:
UPDATE: You don't need to fork Json.NET to do the type instantiation. I'm using a custom
JsonConverteras described in this article.