Tuesday, 2 June 2009

protobuf-net support for 2.1

I've finally found time to add support in protobuf-net for the changes in the main protocol buffers 2.1 release.

For those interested in a fast, efficient, portable (interoperable), obfuscation-safe, binary serialization engine for .NET, then this adds (among other things):

  • "packed" encoding for lists/arrays/etc of simple types (int, float, etc) - much more efficient, as it avoids the need to send a field identifier per element
  • the ability (in .proto definitions) to mark members as deprecated (maps to [Obsolete])


It also introduces a range of bug-fixes, enhancements etc in my own code (nothing to do with 2.1) - including better namespace control when performing code generation.

Probably the biggest difference between protobuf-net and the other implementations is that although you can do contract-first (via a .proto), it doesn't force you to do that - so you can either define you types in a .proto, or you can just use your regular .NET classes with a few attributes (it can even piggy-back of WCF [DataContract]/[DataMember] in many cases). This has always felt more natural to typical .NET development (at least, from what I see).

I'm guessing it'll be a few months before the core Google API changes again, so hopefully this will be the last release (except for very minor bug-fixes) in that branch; I'm still trying to refactor (read: re-implement...) the code to work around those pesky CF limitations (and improve the performance and quality in the process).

Fun fun fun...