On Friday, December 7, 2018 at 12:12:04 PM UTC+5:30, [email protected] 
wrote:
>
> I am trying to find out difference in encoded size using packed equal to 
> true and without any packed encoding. I looped a int32 variable 5000 times. 
> With packed = true, i get size as 29876 and without packed encoding, i get 
> size as 24876. I am confused why i get opposite results. As per my 
> understanding, size with packed should be less as compared to non packed. 
> Can anyone please explain what the issue is?
> My proto file is below for non packed and for packed i modify id filed as; 
> repeated int32 id = 2[packed=true]:
>
> syntax = "proto2";
> message Person {
>   optional string name = 1;
>   repeated int32 id = 2;
>   optional string email = 3;
>
>   enum PhoneType {
>     MOBILE = 0;
>     HOME = 1;
>     WORK = 2;
>   }
>
>   message PhoneNumber {
>     optional string number = 1;
>     optional PhoneType type = 2 [default = HOME];
>   }
>
>   repeated PhoneNumber phones = 4;
> }
>
> message AddressBook {
>   repeated Person people = 1;
> }
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to