Updates:
        Status: WorkingAsIntended

Comment #4 on issue 257 by jas...@google.com: Java Protocol buffer payload more than that of regular payload when using repeated tag
http://code.google.com/p/protobuf/issues/detail?id=257

I tried an example around AddressBook, creating 100 person entries:

for (int i = 0; i < 100; ++i) {
      Person.Builder personBuilder = Person.newBuilder()
          .setName("Person " + i)
          .setId(i)
          .setEmail("person" + i + "@gmail.com");
      builder.addPerson(personBuilder.build());
    }
}

I converted this to an equivalent class (keeping the unused phone entries):
  static class PhoneNumber implements java.io.Serializable {
    public String number;
    public int type;
  }

  static class PersonJava implements java.io.Serializable {
    public String name;
    public int id;
    public String email;
    public List<PhoneNumber> phoneNumbers;
  }

Serializing the equivalent List<PersonJava> was larger:

Proto serialized size: 3480
Java serialized size: 4550

I'm not sure if there's something special about your protocol definition that allows Java serialization to be smaller. However, most of the independent investigations I've seen show that protobuf encoding is smaller. Either way, we can't change the wire format, so I'm closing this bug. Feel free to start a thread on the googlegroup if there's anything you'd like to discuss.

--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to