Thanks for the reply! Could you please add this in the documentation?
On Wednesday, October 28, 2015 at 8:57:09 PM UTC, Feng Xiao wrote: > > On Tue, Oct 27, 2015 at 5:02 AM, <[email protected] <javascript:>> wrote: > >> Hello, >> >> I would like to learn about how oneof's are encoded in binary and what >> the serialization and deserialization cost maybe. To provide with some >> context, I am experimenting with a streaming rpc service. To be specific it >> is a client side streaming, something akin to the grpc documentation: >> >> rpc LotsOfGreetings(stream HelloRequest) returns (HelloResponse) {} >> >> >> As many different messages maybe consumed during a lifetime of a single >> connection, we have opted to use oneofs to handle the different messages >> and dispatched to the appropriate handlers. As we may have potentially >> multiple layers of dispatching, this would require us to have multiple >> layer of oneofs (correct?). >> >> >> What I would like to know is how much type information is stored for the >> unset fields/types. As we may have a complex message hierarchy to solve our >> multiple layers, it would be great if someone could provide us answers >> regarding overhead for this processing as well. >> > On the wire, only the field that's actually set will be serialized so > extra fields in an oneof will have no extra cost. > > In the memory, we use unions in C++ and Object in Java to store oneof > fields, so unset fields will not take extra memory as well. > > Hope this answers your question. > > >> >> >> Thanks! >> >> -- >> 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] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at http://groups.google.com/group/protobuf. >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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 http://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
