[protobuf] Re: Issue 257 in protobuf: Java Protocol buffer payload more than that of regular payload when using repeated tag

2011-02-22 Thread protobuf


Comment #7 on issue 257 by ken...@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

One way that Java serialization can be smaller is if you have a lot of  
repeats of the same values.  Java serialization allows back-links to  
objects that appeared previously in the stream.  Protobuf serialization is  
strictly a tree; if you need back-links, you have to do it manually, by  
storing the redundant values in a separate table and indexing into it from  
the rest of the message.


--
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.



[protobuf] Re: Issue 257 in protobuf: Java Protocol buffer payload more than that of regular payload when using repeated tag

2011-02-18 Thread protobuf


Comment #3 on issue 257 by jayaraga...@gmail.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 have a .proto file which has 53 tags reflecting db columns. Most of them  
are strings with the exception of 4 ints and 1 float. Let us call it a  
Trade message. The 'TradeList' message has repeated tag for Trade. From the  
db results, I created a serialized object to check serialized payload and  
also create proto message. That is how I compared


--
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.



[protobuf] Re: Issue 257 in protobuf: Java Protocol buffer payload more than that of regular payload when using repeated tag

2011-02-18 Thread protobuf

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 ListPhoneNumber phoneNumbers;
  }

Serializing the equivalent ListPersonJava 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.



[protobuf] Re: Issue 257 in protobuf: Java Protocol buffer payload more than that of regular payload when using repeated tag

2011-02-18 Thread protobuf


Comment #5 on issue 257 by jayaraga...@gmail.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

For the most part, I agree with you. Today I tried a proto message for  
another db
report that had 7 fields. I tested upto 35000 records. Proto payload is  
1/3rd the size of java ser payload. Somewhere in the forums, I read that  
above 18 fields in a message, it gets messy. Could you repeat your tests  
with like 50 fields when you get a chance?


--
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.



[protobuf] Re: Issue 257 in protobuf: Java Protocol buffer payload more than that of regular payload when using repeated tag

2011-02-18 Thread protobuf


Comment #6 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

Sorry, I'm going to have to ask you to provide the program if you want to  
look into these larger messages. There are likely going to be some  
applications where the protobuf encoding is larger than other encoding  
formats, but we don't have the resources to construct such examples. There  
may be something about your data that makes the protobuf encoding less  
efficient; if you can provide some examples perhaps we can offer some  
solutions.


I'm not sure of the thread that you mentioned, but due to the varint  
encoding tag numbers above 15 require an extra byte. Perhaps that's what  
you had read? If you have a large number of string fields, I would think  
this byte is pretty negligible relative to the actual payload.


--
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.



[protobuf] Re: Issue 257 in protobuf: Java Protocol buffer payload more than that of regular payload when using repeated tag

2011-02-17 Thread protobuf

Updates:
Owner: ---

Comment #1 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

Can you provide a code snippet? Are you comparing Java serialization with  
protobuf serialization here?


--
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.



[protobuf] Re: Issue 257 in protobuf: Java Protocol buffer payload more than that of regular payload when using repeated tag

2011-02-17 Thread protobuf


Comment #2 on issue 257 by compuwarescc: Java Protocol buffer payload more  
than that of regular payload when using repeated tag

http://code.google.com/p/protobuf/issues/detail?id=257

Are you using a String object in Java?  Is it hard-coded... i.e. interned

--
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.