title: Many subclasses for one base class - protobuf performance
body: <p>Right now I have an application where my iPhone app sends a request that is handled in .NET/C#, serialized to XML, and parsed on the app in objective-c. The current response class structure has one base class (BaseResponse) and many (over 25) subclasses for each type of request that corresponds to different things that need to be returned. Right now I'm looking to see if protobuf would be faster and easier than XML. From what I understand, a .proto file for this class structure is:</p>
  
  <pre><code>Message BaseResponse {
  Required Int field1 = 1;
  Optional SubResponse1 sub1= 2;
  Optional SubResponse2 sub2 = 3;
  Etc....
  }
  
  Message SubResponse1 {
  ....
  }
  
  Message SubResponse2 {
  ....
  }
  Etc for each sub response.
  </code></pre>
  
  <p>My question is: if I have over 25 of these optional elements (of which only 1 will be non null), does that completely wipe away the size and performance benefit of using protobuf? Does protobuf make sense for this application?</p>